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

Adding hurs (realtive humidity) derivation script #2397

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

malininae
Copy link
Contributor

Hi folks,

Following the April 2024 monthly meeting, I'm adding the relative humidity derivation (hurs). Before being able to open a real PR, I would need to add filtering in case the hurs_cb.data >100%. Also need to write test. Will do it before the workshop.

This PR is related to #2254 .

@malininae malininae added enhancement New feature or request preprocessor Related to the preprocessor variable derivation Related to variable derivation functions observations labels Apr 25, 2024
@malininae malininae added this to the v2.12.0 milestone Apr 25, 2024
@malininae malininae self-assigned this Apr 25, 2024
tdps_cube = cubes.extract_cube(NameConstraint(var_name='tdps'))
tas_cube = cubes.extract_cube(NameConstraint(var_name='tas'))

cubes_difference = iris.analysis.maths.subtract(tas_cube, tdps_cube)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cubes_difference = iris.analysis.maths.subtract(tas_cube, tdps_cube)
cubes_difference = tas_cube - tdps_cube

Would this also work? Did you read the section on cube maths in the iris documentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, so when I was trying it with simple tas_cube-tdps_cube the issue was that I was running out of memory, while it wasn't a case with subtract. I will test it again with the time diagnostic and will let you know.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be surprising because it should do the same thing, i.e. the minus operator on an Iris cube is implemented using the exact same function:
https://github.com/SciTools/iris/blob/c5e0353da11c263656c6c77e5e56eafefcede077/lib/iris/cube.py#L3968

@bouweandela
Copy link
Member

would need to add filtering in case the hurs_cb.data >100%

This could probably be done with code like this:

import dask.array as da
hurs_cb.data = da.ma.where(hurs_cb.core_data() > 100., hurs_cb.core_data(), 100.)

@bouweandela
Copy link
Member

If you would like a quicker response in the future, it usually helps if you tag people so they get a notification, e.g. @bouweandela

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request observations preprocessor Related to the preprocessor variable derivation Related to variable derivation functions
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants