-
Notifications
You must be signed in to change notification settings - Fork 9
Issue #1292 mete grids from imod5 #1293
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
Merged
JoerivanEngelen
merged 22 commits into
issue_#1260_from_imod5_data_metaswap
from
issue_#1292_mete_grids_from_imod5
Nov 27, 2024
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
8b3d6d2
Add from_imod5_data for meteo_mappings
JoerivanEngelen 4954dae
Merge branch 'issue_#1260_from_imod5_data_metaswap' into issue_#1292_…
JoerivanEngelen 19d9cc3
Reduce code duplication in tests
JoerivanEngelen 700b349
Add from_imod5_data test and search with proper meteo grid path
JoerivanEngelen 4fbe5c8
Better test name
JoerivanEngelen 0ea21ed
Clean up tests and add from_imod5 test
JoerivanEngelen f40adc4
Format
JoerivanEngelen 6c62638
move file_in_file_list to common utilities
JoerivanEngelen 53770b5
Start working on MeteoGridCopy class
JoerivanEngelen 6369e9f
Merge branch 'master' into issue_#1292_mete_grids_from_imod5
JoerivanEngelen c0be8ed
Add test for meteo grid copy
JoerivanEngelen dad1d98
Merge branch 'issue_#1260_from_imod5_data_metaswap' into issue_#1292_…
JoerivanEngelen 7ad968f
fix bug where path was not properly unpacked from dataset
JoerivanEngelen 7acf033
Add test for from_imod5_data
JoerivanEngelen cc2b71d
format
JoerivanEngelen 316b424
Update changelog
JoerivanEngelen 9566f98
Fix mypy errors
JoerivanEngelen 961b07a
Open mete_grid.inp in context and only read first line
JoerivanEngelen e823ffb
Add test cases where mete_grid.inp is adapted, so that paths are repl…
JoerivanEngelen a9d9b43
Look for first ascii file, skip floats
JoerivanEngelen 29e584e
type annotate
JoerivanEngelen 47a1e7b
Extend docstring
JoerivanEngelen 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,6 +1,15 @@ | ||
| from pathlib import Path | ||
|
|
||
| from imod.typing import GridDataArray | ||
| from imod.typing.grid import concat | ||
|
|
||
|
|
||
| def concat_imod5(arg1: GridDataArray, arg2: GridDataArray) -> GridDataArray: | ||
| return concat([arg1, arg2], dim="subunit").assign_coords(subunit=[0, 1]) | ||
|
|
||
|
|
||
| def find_in_file_list(filename: str, paths: list[str]) -> str: | ||
| for file in paths: | ||
| if filename == Path(file[0]).name.lower(): | ||
| return file[0] | ||
| raise ValueError(f"could not find {filename} in list of paths: {paths}") | ||
Oops, something went wrong.
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.
What does the zeroth index of a file return?
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.
To be frank, I copy+pasted that from the prototype drafted by @HendrikKok. It's worthy of an investigation, because it serves some explanation and might even point to something clumsy in what is done in
open_projectfile_data.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.
This is a relict of how
read_projectfileparses the data: A list for each line in the file, split into elements for each comma in the line. However, in the "EXTRA FILES" text block, there is only one element per line, causing the unnecessary nested list. I'm not sure if I want complicate the logic inread_projectfilewith edge cases, but I could concatenate the lists inopen_projectfile_dataas there all data processing is done.