-
Notifications
You must be signed in to change notification settings - Fork 48
Find files for CMIP6 DCPP startdates #771
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
Merged
Changes from 12 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
70f3b87
First attempte
sloosvel f5d4e05
Do not require start and end years, add them later
sloosvel c73eb4e
Correct condition
sloosvel 0d30f7a
Avoid key error in fx variables
sloosvel 04be270
Solve conflicts
sloosvel 1771c6b
Consider two possible paths
sloosvel 6ad31e5
Fix function name
sloosvel 811026f
Fix variable name
sloosvel 96b236f
Avoid duplicates in filename
sloosvel ec10ee7
Add test for startdate expansion
1b50d62
Merge branch 'master' of https://github.com/ESMValGroup/ESMValCore in…
401abdc
Add test for the replace tags method
599ff5a
Merge branch 'master' of https://github.com/ESMValGroup/ESMValCore in…
dbb4b07
Rename tag
sloosvel 4296a74
Add documentation
sloosvel af7c285
Allow to load subexps per timerange or as a whole
sloosvel 68ff783
Fix condition
sloosvel a303e85
Remove 'all_years' functionality
sloosvel 1737bcb
Fix conditions
sloosvel e0f40cb
Fix flake
sloosvel c9abd1b
Merge remote-tracking branch 'origin/master' into dev_dcpp_startdates
sloosvel 69317c4
Merge remote-tracking branch 'origin/master' into dev_dcpp_startdates
sloosvel aff7769
Remove whitespace
sloosvel 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """Unit tests for :func:`esmvalcore._data_finder.regrid._stock_cube`""" | ||
| from esmvalcore._data_finder import _replace_tags | ||
|
|
||
| VARIABLE = { | ||
| 'project': 'CMIP6', | ||
| 'dataset': 'ACCURATE-MODEL', | ||
| 'activity': 'act', | ||
| 'exp': 'experiment', | ||
| 'institute': 'HMA', | ||
| 'ensemble': 'r1i1p1f1', | ||
| 'mip': 'Amon', | ||
| 'short_name': 'tas', | ||
| 'grid': 'gr', | ||
| } | ||
|
|
||
|
|
||
| def test_replace_tags(): | ||
| """Tests for get_start_end_year function.""" | ||
| path = _replace_tags( | ||
| '{activity}/{institute}/{dataset}/{exp}/{ensemble}/{mip}/{short_name}/' | ||
| '{grid}/{latestversion}', VARIABLE) | ||
| input_file = _replace_tags( | ||
| '{short_name}_{mip}_{dataset}_{exp}_{ensemble}_{grid}*.nc', VARIABLE) | ||
| output_file = _replace_tags( | ||
| '{project}_{dataset}_{mip}_{exp}_{ensemble}_{short_name}', VARIABLE) | ||
| assert path == [ | ||
| 'act/HMA/ACCURATE-MODEL/experiment/r1i1p1f1/Amon/tas/gr/' | ||
| '{latestversion}' | ||
| ] | ||
| assert input_file == ['tas_Amon_ACCURATE-MODEL_experiment_r1i1p1f1_gr*.nc'] | ||
| assert output_file == ['CMIP6_ACCURATE-MODEL_Amon_experiment_r1i1p1f1_tas'] | ||
|
|
||
|
|
||
| def test_replace_tags_with_startdate(): | ||
| """Tests for get_start_end_year function.""" | ||
| variable = {'startdate': '199411', **VARIABLE} | ||
| path = _replace_tags( | ||
| '{activity}/{institute}/{dataset}/{exp}/{ensemble}/{mip}/{short_name}/' | ||
| '{grid}/{latestversion}', variable) | ||
| input_file = _replace_tags( | ||
| '{short_name}_{mip}_{dataset}_{exp}_{ensemble}_{grid}*.nc', variable) | ||
| output_file = _replace_tags( | ||
| '{project}_{dataset}_{mip}_{exp}_{ensemble}_{short_name}', variable) | ||
| assert path == [ | ||
| 'act/HMA/ACCURATE-MODEL/experiment/r1i1p1f1/Amon/tas/gr/' | ||
| '{latestversion}', | ||
| 'act/HMA/ACCURATE-MODEL/experiment/199411-r1i1p1f1/Amon/tas/gr/' | ||
| '{latestversion}' | ||
| ] | ||
| assert input_file == [ | ||
| 'tas_Amon_ACCURATE-MODEL_experiment_199411-r1i1p1f1_gr*.nc' | ||
| ] | ||
| assert output_file == [ | ||
| 'CMIP6_ACCURATE-MODEL_Amon_experiment_199411-r1i1p1f1_tas' | ||
| ] |
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
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.
Uh oh!
There was an error while loading. Please reload this page.