-
Notifications
You must be signed in to change notification settings - Fork 66
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
Model agnostic tutorial #226
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need explorer tools changes? Plus we can be a tidier with operations rather than going all the way through dimension names.
I don't think I understand. |
Just that you've also modified the explorer tools notebook in this PR! Not sure if that was intentional? |
Ah no. I did see that, but just assumed it was the change from the other PR. Will fix.
In this notebook? If so, I don't understand. |
Was referring to the |
Ahh .. yeah, once you pointed it out I took a look, very neat! Do you know off hand the limits of the method wrapping/translation? I think it is probably noting that it is worth using, but maybe won't work for more exotic functions .. or maybe it does work with everything? |
Not sure how it works actually, I think the intention is for it to work everywhere in xarray at least, and if something doesn't work it's a bug on their end. I'd say it's a safe bet to drop in to any method requiring a dimension argument. |
I initially tried also with some ice data, but the multiple grids are a bit annoying. I've realised I can fix that pretty easily, so I think I'll add an ice example as well, just to show it is possible and quite flexible. |
okie! some sea ice vars would be great to have here also! |
This looks great! Can't wait to see the ice addition. |
Okey done. I've added an ice example. It is ugly because the coordinates etc in the ice files are terrible. I don't really like the "now do some barely explained magic" but this isn't a tutorial about fixing ice coordinate data so I haven't dwelt on it. Didn't want to take away from the message. I kept all the errors in to hopefully show how problems like that can be understood and overcome. Hope you like it @edoddridge |
The coordinates in ice files are terrible. I am voicing this also. I'm glad somebody finally had the courage to admit this in public! |
That ice business seems like a bug, cf_xarray only forgets about the specific coordinates after the mean:
I've raised this as a bug xarray-contrib/cf-xarray#396 |
Nice pick-up Angus. I'll change the wording. |
Hi 👋 I came over from the cf-xarray bug report and just wanted to say this is very cool to see. When this notebook goes live, we'd appreciate a PR linking to it from our docs. Our current ocean model demo really emphasizes the vertical aspect, so this would be a nice complement |
Hi @dcherian! That’s great to hear! :) |
View / edit / reply to this conversation on ReviewNB navidcy commented on 2023-01-25T21:06:22Z SST_time_mean.cf.plot(ax=ax, x='longitude', y='latitude', transform=ccrs.PlateCarree(), vmin=-2, vmax=30, extend='both', cmap=cm.cm.thermal) aidanheerdegen commented on 2023-01-26T01:57:17Z This is to align indentation? |
View / edit / reply to this conversation on ReviewNB navidcy commented on 2023-01-25T21:06:23Z da_time_mean.cf.plot(ax=ax, x='longitude', y='latitude', transform=ccrs.PlateCarree(), vmin=-2, vmax=30, extend='both', cmap=cm.cm.thermal)
aidanheerdegen commented on 2023-01-26T01:57:30Z And this too I guess? |
View / edit / reply to this conversation on ReviewNB navidcy commented on 2023-01-25T21:06:23Z Line #1. ice_air_temp = ice_air_temp.drop_vars(['ULON', 'ULAT'])
|
View / edit / reply to this conversation on ReviewNB navidcy commented on 2023-01-25T21:06:24Z Line #1. ice_grid = xr.open_dataset('/g/data/ik11/inputs/access-om2/input_eee21b65/cice_025deg/grid.nc').rename({'ny': 'nj', 'nx': 'ni'})
|
View / edit / reply to this conversation on ReviewNB navidcy commented on 2023-01-25T21:06:25Z da_time_mean.cf.plot(ax=ax, x='longitude', y='latitude', transform=ccrs.PlateCarree(), vmin=vmin, vmax=vmax, extend='both', cmap=cm.cm.thermal) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aidanheerdegen this is great! Two comments, don't feel that you need to act on them:
-
The notebook demonstrates also things that won't work so some cells fail on purpose. This, I presume, will make this tutorial not a good candidate for the automatic testing workflow.
-
I'm not sure if defining functions that plot is a good strategy as they are not so re-usable. I generally prefer to define a function that will do the conversions/transformations on the data array and then have another one that plots. But I feel that's a personal preference...
Hi @dcherian, Thanks for stopping by, but even more thanks for the great work you've done developing this and other tools. Much appreciated.
Sure thing. I'll make a PR to add it to your examples. TBH I'd been telling people to use cf-xarray for ages, but hadn't had an opportunity to use it properly until now, and it is even more transformative than I had realised. It is a great tool. |
I admit, I've been hearing @aidanheerdegen saying this for ages but when I saw the tutorial it was when I really listened. |
This is to align indentation? View entire conversation on ReviewNB |
And this too I guess? View entire conversation on ReviewNB |
Ok, fixed all those formatting suggestions, and found a couple of other typos. I don't have merge permissions @navidcy. Can you do it. Squash the whole thing into a single commit. |
Thanks for the kind words! Please open issues for any features you might find useful. |
Yeap, it was to align the indentation so my OCD eyes are not triggered. |
@angus-g the PR needs your approval? are you happy? |
I'm pretty sure he was ok with it, should be fine to merge |
Done! :) Open the PR at cf-xarray? |
In hand |
This pull request has been mentioned on ACCESS Hive Community Forum. There might be relevant details there: https://forum.access-hive.org.au/t/cosima-hackathon-v2-0-tuesday-january-24th-2023/307/46 |
Model agnostic tutorial using x-array and pint closes #211