-
Notifications
You must be signed in to change notification settings - Fork 29
Add ability to derive variables and add selected derived forcings #34
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
100 commits
Select commit
Hold shift + click to select a range
981d676
First attempt at adding derived forcings
ealerskans 79a94db
Re-structure approach
ealerskans f37161c
Add derivation of cyclic encoded hour of day and day of year
ealerskans 71afd3a
Add derivation of cyclic encoded time of year
ealerskans abb626b
Update and add docstrings
ealerskans 8b1f18e
Remove time_of_year
ealerskans 7854013
Provide the full namespace of the function
ealerskans 7fa90bf
Rename the module with derived variables
ealerskans 48c9e3e
Rename the function used for deriving variables
ealerskans 8de9404
Redefine the config file for derived variables and how they are calcu…
ealerskans ffc030c
Remove derived variables from 'load_and_subset_dataset'
ealerskans 692cdd3
Add try/except for derived variables when loading the dataset
ealerskans c0cd875
Chunk the input data with the defined output chunks
ealerskans 55224f3
Update toa_radiation function name
ealerskans 678ea52
Correct kwargs usage, add back dropped coordinates and return correct…
ealerskans 9d2db07
Prepare for hour_of_day and day_of_year
ealerskans 26455bc
Add optional 'attributes' to the config of 'derived_variables' and ch…
ealerskans fbb6065
Add dummy function for getting lat,lon (preparation for #33)
ealerskans 3a12f48
Add function for chunking data and checking the chunk size
ealerskans 3ace219
Add back coordinates on the subset instead of for each derived variab…
ealerskans a6b61b0
Add 'hour_of_day' to example config
ealerskans 1814297
Merge branch 'main' into feature/derive_forcings
ealerskans 9dcace6
Rename derived variables dataset section in the example config
ealerskans aba6757
Remove f-string from 'name_format'
ealerskans 143edb6
Update README
ealerskans 6aad6d7
Merge branch 'main' into feature/derive_forcings
ealerskans 12e0575
Update CHANGELOG
ealerskans 000ce92
Make functions for deriving toa_radiation and datetime forcings actua…
ealerskans 0af6319
Update docstring and variable names in 'cyclic_encoding'
ealerskans 284db91
Add ranges to lat and lon in docstring
ealerskans ba161d2
Add github username to CHANGELOG entry
ealerskans e3d590c
Update DerivedVariable attributes to be Dict[str, str]
ealerskans f8cae4f
Add missing attribute to docstring
ealerskans 8470c82
Change var names in 'calculate_toa_radiation'
ealerskans 69afdd3
Remove unnecessary 'or None'
ealerskans e17ed8b
Use var name 'dim' instead of 'd'
ealerskans 23b119f
Use var names 'key, val' instead of 'k, v'
ealerskans 2ce53c7
Move '_check_dataset_attributes' outside if statement
ealerskans f1e3d77
Set '{}' as default for 'attributes' and 'chunking'
ealerskans 2afbb35
Make types more explicit
ealerskans 75797a2
Rename 'ds_subset' to 'ds_derived_vars' and update comment for 'ds_in…
ealerskans 31578e8
Add 'Optional[...]' to optional attributes
ealerskans 90e4cf2
Move loading of dataset to a separate function
ealerskans 717c6a5
Simplify if loops
ealerskans 2856c6b
Update '_get_derived_variable_function'
ealerskans 98673ee
Simplify checks of the derived fields
ealerskans 8940e82
Issue warning saying that we assume coordinates are named 'lat' and '…
ealerskans e12e328
Update README to make it clear that 'attributes' is associated with '…
ealerskans ecdea30
Indicate that 'variables' and 'derived_variables' are mutually exclusive
ealerskans e3c0f22
Update docstring of 'InputDataset' class
ealerskans e907a6d
Correct types in '_check_attributes' docstring
ealerskans bb9be13
Use 'rpartition' to get 'module_name' and 'function_name'
ealerskans 49de0b3
Add some initial tests for 'derived_variables'
ealerskans b268f01
Update docstrings and rename 'DerivedVariable.attributes' to 'Derived…
ealerskans dbd5bfd
Do not add 'attributes' to docstring
ealerskans 474a83d
Remove unnecessary exception handling
ealerskans 1da66e2
Move 'subset_dataset' to 'ops.subsetting'
ealerskans dc7dc5e
Move 'derived_variables' to 'ops'
ealerskans c9e96af
Move chunk size check to 'chunking' module
ealerskans 47b8411
Add module docstring
ealerskans 5ae772f
Update tests
ealerskans 2c0bdf8
Add global REQUIRED_FIELD_ATTRIBUTES var and updated check for requir…
ealerskans f1ce6d1
Update long name for toa_radiation
ealerskans 58d8af6
Update README
ealerskans f87b954
Return dropped coordinates to the data-arrays instead
ealerskans 80cf058
Adds dims to the dataset to make it work with derived variables that …
ealerskans da0c171
Add ability to have 'variables' and 'derived_variables' in the same
ealerskans f61a3b6
Update README
ealerskans 554f869
Add 'load_config' function, which wraps 'from_yaml_file' and checks t…
ealerskans 085aae3
Update README
ealerskans 980e511
Move 'chunk_dataset' to the chunking module
ealerskans b6e80d5
Update error message for when missing both 'variables' and 'derived_v…
ealerskans d6c1b36
Move the deriving-functions to a separate module
ealerskans f1e67bc
Update tests
ealerskans 89e9ad8
Rename (and move): 'mllam_data_prep/ops/derived_variables.py' -> 'mll…
ealerskans bdf3466
Use the __post_init__() method to validate the config
ealerskans d3c8693
Loop over 'variables' in 'create_dataset'
ealerskans 0fc31bf
Update file structure
ealerskans 6a7a1e3
Add comment as to why chunking of coordinates is needed
ealerskans 92ad379
Loop over 'derived_variables' in 'create_dataset'
ealerskans d95c031
Add 'extra_args' to 'derived_variables' to allow functions to have ar…
ealerskans e158a6c
Update 'calculate_day_of_year' to only return one component (sin or cos)
ealerskans ff9acc7
Do not modify the arguments in the function for checking (and now get…
ealerskans dc3f200
Update tests for functions for deriving toa_radiation and time compon…
ealerskans 9093534
Update the config version to v0.6.0
ealerskans 233206c
Raise an error if 'component' is neither 'cos' nor 'sin'.
ealerskans b716c13
Update docstring and rename variable
ealerskans 8519da4
Update error message since we now only support xr.DataArrays
ealerskans 79b6e46
Update README
ealerskans 3baa1c0
Tests for _check_and_get_required_attributes and _get_derived_variabl…
mfroelund 245e97b
Restructured test data into fixtures and indirect parametrizations. S…
mfroelund 325866a
Adjusted docstrings
mfroelund 92ae991
Merge pull request #1 from mafdmi/feature/test_derive_forcings
ealerskans c25993d
Merge branch 'main' into feature/derive_forcings
ealerskans c633462
Add mafdmi as contributor
ealerskans ceb0d21
Linting
ealerskans 0ecfcca
Prefix 'function' arguments from the dataset with 'ds_input.'
ealerskans 97ee6dd
Minor updates according to review
ealerskans 14beca8
Change back example in README
ealerskans 209a8d8
Update docstring for 'get_latlon_coords_for_input'
ealerskans 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
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.