-
Notifications
You must be signed in to change notification settings - Fork 0
Preserve time_bnds Variable in Ocean CMORisation Workflow #144
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
Conversation
…nd generate corresponding test
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #144 +/- ##
==========================================
+ Coverage 52.02% 60.74% +8.72%
==========================================
Files 18 18
Lines 2722 2731 +9
==========================================
+ Hits 1416 1659 +243
+ Misses 1306 1072 -234 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
The problem is sometimes time bounds are not available in the dataset and we need to calculate them... |
|
OK, I will add a function to calculate time_bnds if the origin dataset doesn't have one. |
|
I thought we already have that. Did I miss something? |
Maybe I missed something, but I didn’t find any mechanism in the CMORiser to calculate bounds. In the atmosphere datasets we currently use (e.g. under /g/data/p73/archive/CMIP7/ACCESS-ESM1-6/spinup/JuneSpinUp-JuneSpinUp-bfaa9c5b/), |
…ata, and add cooresponding tests
|
The new commit should solved the issue #144, Add automatic time_bnds calculation for CMIP6 compliance Automatically calculate time_bnds when missing from source ocean data, Key Features
Workflow Changes
TestingAdd 8 unit tests covering:
|
|
I'm gonna need to test this one thoroughly before merging. I remember trying something like this for the time_bounds calculation and I was hitting some issues with real data. Thanks @rhaegar325 |
Sure, please let me know if you encounter any issues during testing. |
|
In the new commit, I have add warning for users if there is no |
|
Can you resolve conflicts please? @rhaegar325 |
|
@rbeucher The conflict has now been resolved. |
Summary
This PR ensures that
time_bnds(temporal bounds) are properly loaded, preserved, and validated throughout the ocean CMORisation pipeline. Thetime_bndsvariable is critical for CMIP6 compliance as it defines the temporal boundaries for each time step.Changes
Code Changes (
src/access_moppy/ocean.py)Modified
select_and_process_variables()method:Load
time_bndswith required variablestime_bndstorequired_varsduring dataset loadingPreserve
time_bndsin final datasettime_bndsself.ds = self.ds[[self.cmor_name]]toself.ds = self.ds[[self.cmor_name, time_bnds[0]]]Preserve
time_bndsdimensions in coordinate cleanuptime_bnds(e.g.,nv)time_bndsValidate
time_bndspresence (CMIP6 requirement)time_bndsis missingTest Changes (
tests/unit/test_ocean.py)Added comprehensive unit tests for
time_bndshandling:test_time_bnds_loaded_and_preservedtime_bndsappears in final dataset alongside CMOR variabletest_time_bnds_dimensions_in_used_coordstime_bndsdimensions (time,nv) are preserved as coordinatestest_time_bnds_missing_raises_errortime_bndsraises a clearValueErrortest_required_vars_includes_time_bndstime_bndsis included inrequired_varsduring loadingSupergrid Tests (
tests/unit/test_ocean_supergrid.py)Comprehensive test coverage for the Supergrid class ensures coordinate transformations work correctly:
Initialization & Loading Tests:
B-grid Extraction Tests:
C-grid Extraction Tests:
Output Validation Tests:
(j, i)for centers,(j, i, vertices)for boundsError Handling Tests:
symmetricparameter