-
Notifications
You must be signed in to change notification settings - Fork 12
Regional power spectra using Discrete Cosine Transform (DCT) #1765
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 all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
324798a
add functionality to calculate and plot spectra
cehalliwell 12ecba1
correct line in operators.rst
cehalliwell c81877a
unit tests for power spectrum code
cehalliwell 8cbf4fd
move power spectra operator into plot operator
cehalliwell 0db1864
Tidy up spurious comments
cehalliwell 9a8de34
remove any occurrence of power_spectrum operator (now removed)
cehalliwell 93ab85c
Update unit tests for power spectra code and tidy up
cehalliwell e53f5d4
Remove occurrences of deleted power_spectrum operator
cehalliwell c31fd48
Remove redundant comments
cehalliwell ab55d05
Tidy up comments
cehalliwell 8cc454c
Correct x-axis label for power spectra
cehalliwell b862484
Changes addressing review comments
cehalliwell 055150b
Merge branch 'main' into 215_regional_power_spectra_DCT
jfrost-mo 5549102
Update src/CSET/cset_workflow/meta/diagnostics/rose-meta.conf
cehalliwell 11a81ed
Update src/CSET/cset_workflow/meta/diagnostics/rose-meta.conf
cehalliwell bbe16b3
Update src/CSET/operators/plot.py
cehalliwell 5dffde9
Update src/CSET/operators/plot.py
cehalliwell 5d78282
Update src/CSET/cset_workflow/meta/diagnostics/rose-meta.conf
cehalliwell 0e27884
change name of function _DCT_ps in tests.
cehalliwell 9f67c94
change name of function _create_alpha_matrix in tests.
cehalliwell 81baa6d
Fix comment in docstring
jfrost-mo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,6 +30,7 @@ dependencies = [ | |
| "markdown-it-py >= 3.0", | ||
| "nc-time-axis", | ||
| "iris-grib", | ||
| "scipy", | ||
| "scikit-image", | ||
| ] | ||
|
|
||
|
|
||
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,95 @@ | ||
| # © Crown copyright, Met Office (2022-2025) and CSET contributors. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| """Load power spectrum recipes.""" | ||
|
|
||
| import itertools | ||
|
|
||
| from CSET.recipes import Config, RawRecipe, get_models | ||
|
|
||
|
|
||
| def load(conf: Config): | ||
| """Yield recipes from the given workflow configuration.""" | ||
| # Load a list of model detail dictionaries. | ||
| models = get_models(conf.asdict()) | ||
|
|
||
| # Surface (2D) fields. | ||
| if conf.SPECTRUM_SURFACE_FIELD: | ||
| for field in conf.SURFACE_FIELDS: | ||
| yield RawRecipe( | ||
| recipe="generic_surface_power_spectrum_series.yaml", | ||
| variables={ | ||
| "VARNAME": field, | ||
| "MODEL_NAME": [model["name"] for model in models], | ||
| "SEQUENCE": "time" | ||
jfrost-mo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if conf.SPECTRUM_SURFACE_FIELD_SEQUENCE | ||
| else "realization", | ||
| "SUBAREA_TYPE": conf.SUBAREA_TYPE if conf.SELECT_SUBAREA else None, | ||
| "SUBAREA_EXTENT": conf.SUBAREA_EXTENT | ||
| if conf.SELECT_SUBAREA | ||
| else None, | ||
| }, | ||
| model_ids=[model["id"] for model in models], | ||
| aggregation=False, | ||
| ) | ||
|
|
||
| # Pressure level fields. | ||
| if conf.SPECTRUM_PLEVEL_FIELD: | ||
| for field, plevel in itertools.product( | ||
| conf.PRESSURE_LEVEL_FIELDS, | ||
| conf.PRESSURE_LEVELS, | ||
| ): | ||
| yield RawRecipe( | ||
| recipe="generic_level_power_spectrum_series.yaml", | ||
| variables={ | ||
| "VARNAME": field, | ||
| "LEVELTYPE": "pressure", | ||
| "LEVEL": plevel, | ||
| "MODEL_NAME": [model["name"] for model in models], | ||
| "SEQUENCE": "time" | ||
jfrost-mo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if conf.SPECTRUM_PLEVEL_FIELD_SEQUENCE | ||
| else "realization", | ||
| "SUBAREA_TYPE": conf.SUBAREA_TYPE if conf.SELECT_SUBAREA else None, | ||
| "SUBAREA_EXTENT": conf.SUBAREA_EXTENT | ||
| if conf.SELECT_SUBAREA | ||
| else None, | ||
| }, | ||
| model_ids=[model["id"] for model in models], | ||
| aggregation=False, | ||
| ) | ||
|
|
||
| # Model level fields | ||
| if conf.SPECTRUM_MLEVEL_FIELD: | ||
| for field, mlevel in itertools.product( | ||
| conf.MODEL_LEVEL_FIELDS, | ||
| conf.MODEL_LEVELS, | ||
| ): | ||
| yield RawRecipe( | ||
| recipe="generic_level_power_spectrum_series.yaml", | ||
| variables={ | ||
| "VARNAME": field, | ||
| "LEVELTYPE": "model_level_number", | ||
| "LEVEL": mlevel, | ||
| "MODEL_NAME": [model["name"] for model in models], | ||
| "SEQUENCE": "time" | ||
jfrost-mo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if conf.SPECTRUM_MLEVEL_FIELD_SEQUENCE | ||
| else "realization", | ||
| "SUBAREA_TYPE": conf.SUBAREA_TYPE if conf.SELECT_SUBAREA else None, | ||
| "SUBAREA_EXTENT": conf.SUBAREA_EXTENT | ||
| if conf.SELECT_SUBAREA | ||
| else None, | ||
| }, | ||
| model_ids=[model["id"] for model in models], | ||
| aggregation=False, | ||
| ) | ||
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.