-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alc and gex header fix #10
Open
mp-emrld
wants to merge
9
commits into
master
Choose a base branch
from
alc-gex-header-fix
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3c0b701
fixed AarhusWorkbench input requirements
mp-emrld 46d9335
cleanup
mp-emrld cede8a0
minor mod
mp-emrld 457ee36
small bugfix
mp-emrld 98f51c8
minor mods
mp-emrld af8b809
minor cleanup
mp-emrld ca59955
minor mods
mp-emrld 5a5e4fa
fixed header issue so that it's a list and not an index
burningsage 2c5c11a
Merge branch 'alc-gex-header-fix' of https://github.com/emerald-geomo…
burningsage File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,15 @@ | |
# with the naming convention used in Aaarhus Workbench / ALC files. | ||
_RE_LAYER_COL = re.compile(r"^(.*?)[(_\[]([0-9]+)[)\]]?$") | ||
|
||
_NA_VALUES = ["", "#N/A", "#N/A N/A", "#NA", "-1.#IND", "-1.#QNAN", "-NaN", "-nan", "1.#IND", "1.#QNAN", "<NA>", | ||
|
||
_NA_VALUES = [9999, 9999.9, "9999", "9999.9", "", "#N/A", "#N/A N/A", "#NA", "-1.#IND", "-1.#QNAN", "-NaN", "-nan", "1.#IND", "1.#QNAN", "<NA>", | ||
"N/A", "NA", "NULL", "NaN", "n/a", "nan", "null", "*"] | ||
|
||
|
||
def _split_layer_columns(df): | ||
per_layer_cols = [col for col in df.columns if re.match(_RE_LAYER_COL, col)] | ||
per_sounding_cols = [col for col in df.columns if not col in per_layer_cols] | ||
|
||
colgroups = {} | ||
for col in per_layer_cols: | ||
group = re.match(_RE_LAYER_COL, col).groups()[0] | ||
|
@@ -115,7 +116,7 @@ def _parse(inputfile, source=None, alcfile=None, **kw): | |
res = {"flightlines": df, | ||
"layer_data": layer_dfs, | ||
"model_info": headers, | ||
"file_meta": {"columns": full_df.columns}} | ||
"file_meta": {"columns": list(full_df.columns)}} | ||
|
||
if alcdata is not None: | ||
res["alc_info"] = alcdata["meta"] | ||
|
@@ -142,13 +143,14 @@ def _un_split_layer_columns(data): | |
|
||
def _dump(data, file, alcfile=None): | ||
df = _un_split_layer_columns(data) | ||
for key, value in data['model_info'].items(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd propose adding separate argument |
||
if key != 'source': | ||
file.write("/" + str(key) + "\n") | ||
if isinstance(value, list): | ||
file.write("/" + ' '.join(str(item) for item in value) + "\n") | ||
else: | ||
file.write("/" + str(value) + "\n") | ||
if alcfile==None: | ||
for key, value in data['model_info'].items(): | ||
if key != 'source': | ||
file.write("/" + str(key) + "\n") | ||
if isinstance(value, list): | ||
file.write("/" + ' '.join(str(item) for item in value) + "\n") | ||
else: | ||
file.write("/" + str(value) + "\n") | ||
file.write('/ ') | ||
df.to_csv(file, index=False, sep=' ', na_rep="*", encoding='utf-8') | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe split this into a separate function?
columns = clean_column_names(columns)