-
Notifications
You must be signed in to change notification settings - Fork 21
Add climo wrapper #539
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
Add climo wrapper #539
Changes from 129 commits
Commits
Show all changes
146 commits
Select commit
Hold shift + click to select a range
dd48ab1
Start for climo wrapper (fre app gen-time-averages-wrapper)
9c2e202
Merge remote-tracking branch 'origin/main' into add-climo-wrapper
f74645d
Updated click parsing for fre app gen-time-averages-wrapper
c7c7f1d
Add the wrapper.py this time
8886a26
Convert pathlib objects to strings during cdo call creation
dfa40e5
Needed updates to climo wrapper
dd06814
Start of climo wrapper test
c4825a1
Generate netcdf test input files from ascii CDF files
5467c55
simplify directory setup
3b29798
Completed test for monthly history to annual climo
e7f4367
type adjustments
542a0f3
add annual-av-from-annual-history test
e0a230d
fix typo
6a081be
Fix output filename for monthly climatologies
fc5ce14
Save monthly output in the same user-specified directory
fa2d0df
Added monthly climo from monthly timeseries test
691418f
add fre app combine-time-averages
7e3172a
docstrings for fre app gen-time-averages-wrapper
a5a9afc
finished the climo combiner
b34b538
add docstrings for fre app combine-timeavgs
4ee12af
remove do_timeavgs pp yaml switch (now controlled in 'climatology' se…
7773a83
Added test for combining annual climatologies
7e3bca6
fre app combine-time-averages good to go
5318365
Add chdir to return to original working directory
6fce01e
Add test for monthly average combining
868f02a
Remove test files erroneously included in the repository.
7126721
Python f-strings are the superior method for string concatenation
892cd67
Simplify imports for metomi date parsers
22d193e
Merge remote-tracking branch 'origin/main' into add-climo-wrapper
dab3775
Move poorly-formatted filepaths out of doc-strings
2f00fff
Fixed docstrings
e0c9dd5
Add docstrings for exceptions
3fd53f5
Cleaned up imports in pytests
c592969
Merge remote-tracking branch 'origin/main' into add-climo-wrapper
1c60dbd
add combine.py module to fre.app.generate_time_averages module
d785566
Removed do_timeavgs switch from test yamls
3bc0e87
clean up fre/app/freapp.py
7f629bf
Update fre-cli click tests to look for exit 0 when running non-error …
8bbd1e8
one more removal of do_timeavgs option from example yamls
9508f4b
Set 'fre pp generate-time-averages-wrapper' tests to xfail
a310e5b
fre app combine-time-averages begin and end should be integars not st…
f79da97
remap bugfix
a188316
remap bugfix- string boolean is odd
1154893
Revert "Update fre-cli click tests to look for exit 0 when running no…
d4ffcd3
Replace string to boolean conversion with a click option
0b2f833
Merge branch 'main' into add-climo-wrapper
ilaflott 93937b2
Initial plan
Copilot 1359293
Fix remap_pp_components file naming issue causing test failures
Copilot 49fa0a6
Enable workflow to run for this specific PR branch
Copilot dd10e4b
Add pkg parameter to generate time averages wrapper and CDO tests
Copilot 76cbf57
Fix Path vs string typing issues and timavg.csh availability check in…
Copilot 632a372
Fix CDO monthly test expectations and mark timavg.csh tests as xfail
Copilot b0fc58d
print --> logging
ilaflott 04f0b0d
more specific error message
ilaflott 6ce3dfe
print --> logging
ilaflott 709deb6
better output handling, reduce annoying and useless locals output
ilaflott c504126
remove worthless output printing thats redundant with logging functio…
ilaflott c54cc7f
break up a long line
ilaflott fd7f999
clean up and proper TODO
ilaflott 142513d
clarify tests
ilaflott 129d2dc
reduce input test data files to minimum, to help with debugging by-ey…
ilaflott 7b0bb2b
use unweighted stats for averaging
ilaflott 8a9dbb0
Merge pull request #655 from NOAA-GFDL/copilot/fix-8ed54e3a-c382-4fe1…
ilaflott 4cf6da6
Change pytest log level from INFO to DEBUG
ilaflott 423699d
Merge branch 'main' into add-climo-wrapper
ilaflott c9eae1d
Adjust cdoTimeAverage to save out per-month files like fre-nctools ti…
bc52ad8
fre app gen-time-averages-wrapper to use cdo backend for now
3a183fc
remove xfails from climo tests
d00329b
Merge branch 'add-climo-wrapper-chris' into add-climo-wrapper
6cf201b
disable timavg.csh test
b5c9dcf
updated cdo climo test
a63a058
disable fre-nctools tests
58d08f9
adjust cdo climo monthly tests
ff659f7
Merge branch 'main' into add-climo-wrapper
ilaflott 926ae4c
Add branches filter for pull request in spell check
ilaflott 7f5fe52
Remove branch filter for copilot and update pylint failure threshold …
ilaflott 4006b4e
for github codespace
ilaflott 65c2905
Refactor combine function to use context manager for directory change…
ilaflott b3db6c4
move mask atmos plevel tests
ilaflott 20c3c67
tweak reqs and alphabetize dep/req lists. remove host requirements an…
ilaflott 9b1cf2e
pin cftime to 1.6 something
ilaflott b347735
remove jinja template pointing to... a host installed python, i think?
ilaflott 2ae2dee
ok fine random jinja variable definitions for PYTHON it is...
ilaflott 39b521c
curious experiment: test reqs for pytest pytest-cov and pylint, what …
ilaflott edb5f17
tweak pyproject
ilaflott 137f2b1
not clear why pylint cant be found at the testing step
ilaflott fc88604
is it a slight race condition? is the test step executing slightly be…
ilaflott bb4c298
stop installing a non-existent conda-forge::conda-verify
ilaflott 3934af0
OH the test key under requirements doesnt exist. testing reqs go unde…
ilaflott e722c91
heavily update test_generate_time_averages
ilaflott 1d93dd5
init for mask_atmost_plevel tests
ilaflott 29ffd69
update the other bits too
ilaflott 013088b
readability edits, remove a redundant test case or two, condtional xs…
ilaflott 95bae4f
some module import changes, comment out a case i prefer xfail, but se…
ilaflott f6b221c
increase clarity of testing constant file names. try weird shutil,whi…
ilaflott 65d4a62
actually add the timeaverager edit this time
ilaflott 8886291
verbose flag to timavg.csh, and comment out the fre-nctools calls, si…
ilaflott 4b405e4
explicitly list packages and their versions from the environment. als…
ilaflott be974fc
remove a bad assertion i used for local debugging, aadd some extra c…
ilaflott 9d58b14
omg environment please just solve
ilaflott 86e5a63
why is this happening to me
ilaflott d153832
Update numpy and xarray version constraints
ilaflott 9d65240
Remove netcdf4 from environment.yml
ilaflott e0fe628
Update meta.yaml
ilaflott e3d61c2
Update dependencies and Python version in meta.yaml
ilaflott b76136a
Modify environment.yml for dependency updates
ilaflott beab0a8
more explicitly configure conda in create_test_conda_env workflow, re…
ilaflott 04adfbe
conda build has a debug flag, not a verbose flag
ilaflott 1fd9686
ok now remove pylint pytest-cov and pytest from the environment yaml …
ilaflott 5ff7586
remove pip as a dep, its a std module of python for awhile now. remov…
ilaflott fa1070f
another attempt at env resolution, mark a comparison test xfail
ilaflott 2d2840f
xfail the right test
ilaflott e4b8066
conda update conda in workflows, change channel order as it affects e…
ilaflott dc16413
make conda confguration very explcit, show config before final calls,…
ilaflott 9a04a13
make conda confguration very explcit, show config before final calls,…
ilaflott e0f754e
Merge remote-tracking branch 'origin/add-climo-wrapper' into add-clim…
ilaflott b2f6ac0
fine, lets try a conda init
ilaflott 2472d3d
try normal conda-verify and anaconda-client. also directly source /pa…
ilaflott 16ff1f1
forget the root/bashrc sourcing. add some extra steps
ilaflott cc18f08
move the conda sourcing and conda init to where the env activation is
ilaflott 9e509f8
newer condabuilds seem unhappy with a None version specifier in the m…
ilaflott 87dee76
syntax error...
ilaflott a751f29
missing parenthesis in meta yaml. activate the fre-cli environment ex…
ilaflott c779ae6
remove now unused and always-not-working load_setup_py_data from meta…
ilaflott 2ea1a62
better echos, line spacing, workflow file formatting, propagate the c…
ilaflott 30a024d
ok so the options key is not negotiable, i understand
ilaflott 8280676
pylint feedback, env tweak, put the testing stuff back where it was, …
ilaflott 2d97382
increase num of allowed positional args to 6 from 5, inch up the thre…
ilaflott a752650
break up a long line and implement way of avoiding redefining a pytho…
ilaflott 2440bcc
largely pylint feedback, and some review feedback
ilaflott fb1ddd6
update cdoTimeAverager according to some feedbacl
ilaflott 958cf45
better comments for workflow files
ilaflott 008cf24
some review feedback
ilaflott cc42140
fixing a bug i introduced
ilaflott 2a962f6
pylintrc file for explicit pylint call configuration. add new --rcfil…
ilaflott 0c07ebc
remove time use from click entrypoint file and put with generate_time…
ilaflott 1211192
add some TODO items now, dont be shy! pylint wont ding you for trying…
ilaflott 7f650b6
spacing mostly to address feedback
ilaflott 4010ce3
fix an oops in the workflow file
ilaflott ed18d34
spacing / review fedback
ilaflott 0e0b752
removed unreachable else statement, since the error condition is chec…
ilaflott 7dd313c
clean up how the value error for an unsupported frequency gets raised…
ilaflott 4bdcff9
touch up when/how value error is raised in generate_time_Averages, ad…
ilaflott 6117d24
last tweaks and last env experiment, let cmor be >=3.11
ilaflott dbef853
remove unneeded file
ilaflott 5dabfd0
prototype CLI tests for the time-averager, printouts for the non-cli …
ilaflott 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
Some comments aren't visible on the classic Files Changed page.
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 |
|---|---|---|
| @@ -1,7 +1,11 @@ | ||
| name: 'Check spelling' | ||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| push: | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| spellcheck: | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -6,7 +6,9 @@ | |
|
|
||
| from .mask_atmos_plevel.mask_atmos_plevel import mask_atmos_plevel_subtool | ||
| from .generate_time_averages.generate_time_averages import generate | ||
| from .generate_time_averages.wrapper import generate_wrapper | ||
| from .regrid_xy.regrid_xy import regrid_xy | ||
| from .generate_time_averages.combine import combine | ||
ceblanton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from .remap_pp_components.remap_pp_components import remap_pp_components | ||
|
|
||
| @click.group(help=click.style(" - app subcommands", fg=(250,154,90))) | ||
|
|
@@ -158,3 +160,80 @@ | |
| start_time = time.perf_counter() | ||
| generate(inf, outf, pkg, var, unwgt, avg_type) | ||
| click.echo(f'Finished in total time {round(time.perf_counter() - start_time , 2)} second(s)') | ||
|
|
||
| @app_cli.command() | ||
| @click.option("--cycle-point", | ||
| type = str, | ||
| required = True, | ||
| help = "Beginning cycle-point in ISO8601") | ||
| @click.option("--dir", 'dir_', | ||
| type = str, | ||
| required = True, | ||
| help = "Root directory containing the shards") | ||
| @click.option("--sources", | ||
| type = str, | ||
| required = True, | ||
| help = "Sources (history file) input file, comma-separated") | ||
| @click.option("--output-interval", | ||
| type = str, | ||
| required = True, | ||
| help = "ISO interval of the desired climatology") | ||
| @click.option("--input-interval", | ||
| type = str, | ||
| required = True, | ||
| help = "ISO interval of the input timeseries") | ||
| @click.option("--grid", | ||
| type = str, | ||
| required = True, | ||
| help = "Grid label corresponding to the shards directory, e.g. native, regrid-xy/180_288.conserve_order2") | ||
|
|
||
| @click.option("--frequency", | ||
| type = str, | ||
| required = True, | ||
| help = "Frequency of desired climatology: 'mon' or 'yr'") | ||
| @click.option("-p", "--pkg", | ||
| type = click.Choice(["cdo","fre-nctools","fre-python-tools"]), | ||
| default = "cdo", | ||
| help = "Time average approach") | ||
| def gen_time_averages_wrapper(cycle_point, dir_, sources, output_interval, input_interval, grid, frequency, pkg): | ||
| """ | ||
| Wrapper for climatology tool. | ||
|
Member
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. better description needed |
||
| Timeaverages all variables for a desired cycle point, source, and grid. | ||
| """ | ||
| sources_list = sources.split(',') | ||
ceblanton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| generate_wrapper(cycle_point, dir_, sources_list, output_interval, input_interval, grid, frequency, pkg) | ||
|
|
||
| @app_cli.command() | ||
| @click.option("--in-dir", | ||
| type = str, | ||
| required = True, | ||
| help = "Input directory") | ||
| @click.option("--out-dir", | ||
| type = str, | ||
| required = True, | ||
| help = "Output directory") | ||
| @click.option("--component", | ||
| type = str, | ||
| required = True, | ||
| help = "Component name to combine") | ||
| @click.option("--begin", | ||
| type = int, | ||
| required = True, | ||
| help = "Beginning year") | ||
| @click.option("--end", | ||
| type = int, | ||
| required = True, | ||
| help = "Ending year") | ||
| @click.option("--frequency", | ||
| type = str, | ||
| required = True, | ||
| help = "Climatology frequency; 'mon' or 'yr'") | ||
| @click.option("--interval", | ||
| type = str, | ||
| required = True, | ||
| help = "Climatology interval in ISO8601") | ||
| def combine_time_averages(in_dir, out_dir, component, begin, end, frequency, interval): | ||
| """ | ||
| Combine per-variable climatologies into one file | ||
| """ | ||
| combine(in_dir, out_dir, component, begin, end, frequency, interval) | ||
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,3 +1,3 @@ | ||
| '''required for generate_time_averages module import functionality''' | ||
| __all__ = ['generate_time_averages', 'timeAverager', | ||
| __all__ = ['generate_time_averages', 'timeAverager', 'wrapper', 'combine', | ||
ilaflott marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 'frenctoolsTimeAverager', 'cdoTimeAverager', 'frepytoolsTimeAverager'] | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.