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

Some cases with 'nan' for max and min values #2

Closed
ellesmith88 opened this issue Feb 24, 2020 · 5 comments
Closed

Some cases with 'nan' for max and min values #2

ellesmith88 opened this issue Feb 24, 2020 · 5 comments
Assignees

Comments

@ellesmith88
Copy link
Collaborator

No description provided.

@agstephens
Copy link
Contributor

@ellesmith88: here is another useful issue to look at. If you can find an example of a NaN then it would be good for us to take a look into why it is happening.

@ellesmith88
Copy link
Collaborator Author

The data at /badc/cmip5/data/cmip5/output1/MOHC/HadGEM2-ES/historical/mon/land/Lmon/r1i1p1/latest/rh produces NaNs for the maximum and minimum of its data values. I'll have a look at the data again for this one.

@ellesmith88
Copy link
Collaborator Author

ellesmith88 commented Feb 27, 2020

NaNs are missing values filled in by xarray. To mask them:
ds = xr.open_mfdataset('/badc/cmip5/data/cmip5/output1/MOHC/HadGEM2-ES/historical/mon/land/Lmon/r1i1p1/latest/rh/*.nc', combine='by_coords')
masked_data = ds.rh.to_masked_array(copy=False)
mx = masked_data.max()
mn = masked_data.min()

@ellesmith88
Copy link
Collaborator Author

@agstephens Not fixed in version 0.15. Found that different methods give different results.

If done in this way:
data = ds.rh.values
mx = data.max()
the result is still NaN.

If extracted in this way:
mx = float(ds.rh.max())
the result is the same as with using the masked array.

@agstephens
Copy link
Contributor

Done.

@ellesmith88 ellesmith88 transferred this issue from roocs/character-scanner-test Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants