Skip to content
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

Fix for CESM2 thetao olev units from cm to m #888

Closed
wants to merge 5 commits into from

Conversation

valeriupredoi
Copy link
Contributor

@valeriupredoi valeriupredoi commented Nov 30, 2020

As described in #859 and its older sister #515 CESM2 thetao has generic vertical level olev in cm instead of m. Questions before we go further with this:

Before you start, please read our contribution guidelines.

Tasks

  • Create an issue to discuss what you are going to do, if you haven't done so already (and add the link at the bottom)
  • This pull request has a descriptive title that can be used in a changelog
  • Add unit tests
  • Public functions should have a numpy-style docstring so they appear properly in the API documentation. For all other functions a one line docstring is sufficient.
  • If writing a new/modified preprocessor function, please update the documentation
  • Circle/CI tests pass. Status can be seen below your pull request. If the tests are failing, click the link to find out why.
  • Codacy code quality checks pass. Status can be seen below your pull request. If there is an error, click the link to find out why. If you suspect Codacy may be wrong, please ask by commenting.
  • Please use yamllint to check that your YAML files do not contain mistakes
  • If you make backward incompatible changes to the recipe format, make a new pull request in the ESMValTool repository and add the link below

If you need help with any of the tasks above, please do not hesitate to ask by commenting in the issue or pull request.


Closes #issue_number

@valeriupredoi valeriupredoi added fix for dataset Related to dataset-specific fix files data issue labels Nov 30, 2020
@sloosvel
Copy link
Contributor

sloosvel commented Dec 2, 2020

@jvegasbsc @sloosvel I have forgotten - how are we treating these olevs - do they have a standard_name at all?

Standard name should be 'depth' in this case:

       "depth_coord": {
            "standard_name": "depth", 
            "units": "m", 
            "axis": "Z", 
            "long_name": "ocean depth coordinate", 
            "climatology": "", 
            "formula": "", 
            "must_have_bounds": "yes", 
            "out_name": "lev", 
            "positive": "down", 
            "requested": "", 
            "requested_bounds": "", 
            "stored_direction": "increasing", 
            "tolerance": "", 
            "type": "", 
            "valid_max": "12000.0", 
            "valid_min": "0.0", 
            "value": "", 
            "z_bounds_factors": "", 
            "z_factors": "", 
            "bounds_values": "", 
            "generic_level_name": "olevel"
}

@valeriupredoi
Copy link
Contributor Author

nice, cheers Saskia!

@valeriupredoi valeriupredoi requested review from sloosvel and removed request for sloosvel December 11, 2020 11:43
@valeriupredoi
Copy link
Contributor Author

hokeydokey @sloosvel I have now added standard_name - indepthed to you if you pls review this PR 😁

@sloosvel
Copy link
Contributor

This fix is setting the standard name fine and the proper units for the points of the depth coord as well. But the bounds are also getting converted and do not quite match the points:

DimCoord(array([5.00000000e+00, 1.50000000e+01, 2.50000000e+01, 3.50000000e+01,
       4.50000000e+01, 5.50000000e+01, 6.50000000e+01, 7.50000000e+01,
       8.50000000e+01, 9.50000000e+01, 1.05000000e+02, 1.15000000e+02,
       1.25000000e+02, 1.35000000e+02, 1.45000000e+02, 1.55000000e+02,
       1.65098398e+02, 1.75479043e+02, 1.86291270e+02, 1.97660273e+02,
       2.09711387e+02, 2.22578281e+02, 2.36408828e+02, 2.51370156e+02,
       2.67654199e+02, 2.85483652e+02, 3.05119219e+02, 3.26867988e+02,
       3.51093477e+02, 3.78227617e+02, 4.08784648e+02, 4.43377695e+02,
       4.82736719e+02, 5.27728008e+02, 5.79372891e+02, 6.38862617e+02,
       7.07563281e+02, 7.87002500e+02, 8.78825234e+02, 9.84705859e+02,
       1.10620422e+03, 1.24456687e+03, 1.40049719e+03, 1.57394641e+03,
       1.76400328e+03, 1.96894422e+03, 2.18645656e+03, 2.41397156e+03,
       2.64900125e+03, 2.88938469e+03, 3.13340469e+03, 3.37979344e+03,
       3.62767031e+03, 3.87645188e+03, 4.12576813e+03, 4.37539250e+03,
       4.62519031e+03, 4.87508344e+03, 5.12502812e+03, 5.37500000e+03]), bounds=array([[ 0.       ,  0.1      ],
       [ 0.1      ,  0.2      ],
       [ 0.2      ,  0.3      ],
       [ 0.3      ,  0.4      ],
       [ 0.4      ,  0.5      ],
       [ 0.5      ,  0.6      ],
       [ 0.6      ,  0.7      ],
       [ 0.7      ,  0.8      ],
       [ 0.8      ,  0.9      ],
       [ 0.9      ,  1.       ],
       [ 1.       ,  1.1      ],
       [ 1.1      ,  1.2      ],
       [ 1.2      ,  1.3      ],
       [ 1.3      ,  1.4      ],
       [ 1.4      ,  1.5      ],
       [ 1.5      ,  1.600492 ],
       [ 1.600492 ,  1.702887 ],
       [ 1.702887 ,  1.8088516],
       [ 1.8088516,  1.9197578],
       [ 1.9197578,  2.0368583],
       [ 2.0368583,  2.1614485],
       [ 2.1614485,  2.2949357],
       [ 2.2949357,  2.438895 ],
       [ 2.438895 ,  2.5951219],
       [ 2.5951219,  2.7656894],
       [ 2.7656894,  2.9530146],
       [ 2.9530146,  3.159936 ],
       [ 3.159936 ,  3.3898075],
       [ 3.3898075,  3.6466055],
       [ 3.6466055,  3.9350615],
       [ 3.9350615,  4.260812 ],
       [ 4.260812 ,  4.630572 ],
       [ 4.630572 ,  5.0523233],
       [ 5.0523233,  5.535505 ],
       [ 5.535505 ,  6.0911775],
       [ 6.0911775,  6.7321296],
       [ 6.7321296,  7.472829 ],
       [ 7.472829 ,  8.329139 ],
       [ 8.329139 ,  9.317656 ],
       [ 9.317656 , 10.45455  ],
       [10.45455  , 11.753855 ],
       [11.753855 , 13.22532  ],
       [13.22532  , 14.872219 ],
       [14.872219 , 16.689749 ],
       [16.689749 , 18.664738 ],
       [18.664738 , 20.777002 ],
       [20.777002 , 23.002142 ],
       [23.002142 , 25.314863 ],
       [25.314863 , 27.69193  ],
       [27.69193  , 30.113947 ],
       [30.113947 , 32.56599  ],
       [32.56599  , 35.03732  ],
       [35.03732  , 37.520615 ],
       [37.520615 , 40.0111   ],
       [40.0111   , 42.505802 ],
       [42.505802 , 45.00291  ],
       [45.00291  , 47.501366 ],
       [47.501366 , 50.000557 ],
       [50.000557 , 52.500137 ],
       [52.500137 , 54.999863 ]], dtype=float32), standard_name=None, units=Unit('m'), var_name='lev', attributes={'positive': 'down', 'title': 'ocean model level', 'type': 'double'})

Maybe they should be scaled back? Since they originally had the right values but wrong units.

@schlunma
Copy link
Contributor

schlunma commented May 4, 2021

I will have a look at this right now. Would you mind if I push directly to this branch @valeriupredoi?

@schlunma schlunma added this to the v2.3.0 milestone May 4, 2021
@tomaslovato
Copy link
Contributor

tomaslovato commented May 4, 2021

@schlunma @valeriupredoi if it can be of any help I worked with this dataset as well and I figured out one possible fix (along with more general issues about depth coordinates) in 1464c52. Further changes are also available in branch ce2coast (but I was shy and I didn't open another PR)

@schlunma
Copy link
Contributor

schlunma commented May 4, 2021

@tomaslovato Nice! I really like the idea of specifying a fix for every variable in a given table! I will open a new issue so it's more visible. We can continue the discussion there.

schlunma pushed a commit that referenced this pull request May 4, 2021
@schlunma schlunma mentioned this pull request May 4, 2021
10 tasks
@schlunma
Copy link
Contributor

schlunma commented May 4, 2021

Superseded by #1095.

@schlunma schlunma closed this May 4, 2021
schlunma added a commit that referenced this pull request May 5, 2021
* add cmor variables table in the check of fixes classes (#1069)

(cherry picked from commit 0837102)

* add ocean depth shared fix and cesm2 dataset fix for depth (#1069, #888)

(cherry picked from commit 1464c52)

* Added units test for mip-level fixes

* Added units test for fix_depth_coord

* Update cesm2.py

Co-authored-by: Tomas Lovato <[email protected]>
@schlunma schlunma deleted the fix_cesm2_olev_units branch May 5, 2021 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix for dataset Related to dataset-specific fix files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants