rcaneill / xnemogcm

Interface to open NEMO global circulation model output dataset with xarray and create a xgcm grid.
https://xnemogcm.readthedocs.io/
MIT License
21 stars 10 forks source link

Reading of NEMO ice fields (*_grid_I.nc) #15

Closed atb299 closed 3 years ago

atb299 commented 3 years ago

xnemogcm doesn't currently read *grid_I.nc files.

There's potential to cause problems by addressing this as NEMO has been coupled to several ice models, not all following the same Arakawa grid convention.

I added "I" before the "T"s in xnemogcm/arakawa_points.py and for those of us that use LIM2, LIM3 or SI3 this does appear to work OK (albeit with minimal testing). However, a more careful consideration of how to treat *_grid_I.nc files would be good.

rcaneill commented 3 years ago

Hi @atb299 , thanks for your interest. You are right, xnemogcm is not mature yet.

I am not an expert of sea-ice outputs. Are they only a surface 2D field? You say that all ice models don't follow the same Arakawa grid conventions, you mean that some ice models output variables at the surface T point, while other at the surface U, V or F point? xnemogcm is capable of opening surface fields (e.g. if you output only the SST in a *grid_T.nc file it will open it), so my guess is that if you rename your ice files in e.g. ice_grid_T.nc it will work. This is only a hack though.

I'll be happy to discuss what kind of API would seem logical to you, as for me and my colleagues using the *grid_X.nc convention was practical. But I was thinking to put options to overwrite these hardcoded filenames.

For the seek of completeness, have you tried using xorca?

atb299 commented 3 years ago

I am not an expert of sea-ice outputs.

Me neither! There's a lot of 2D fields, but some ice models/fields can have multi-category (i.e. layers). This would require another dimension, but I'm not sure what it would be called.

Some ice models that have been coupled to NEMO follow an Arakawa 'B' grid (e.g. CICE), rather than using the same Arakawa 'C' grid that NEMO does. This would complicate the handling of the ice tracer and velocity points for the API.

Good suggestion about renaming files. I already made links because the grid?_.nc appears in the middle of my filenames rather than at the end.

I should also stress that I am new to package development, so my suggestions might not make sense at times!

I am aware of xorca, but haven't tried it yet.

rcaneill commented 3 years ago

@atb299 can I close this issue? Did you manage to open the ice fields easily?

atb299 commented 3 years ago

@atb299 can I close this issue? Did you manage to open the ice fields easily?

Yes, you can close this now. Thanks.

rcaneill commented 2 years ago

Hello @atb299 , in the future release of xnemogcm (can be released asap if you need it, otherwise I may implement few more things before), it is possible to process each file individually, without any constraint on the filename. In case you need it for your ice files, here is the WIP doc: https://nbviewer.ipython.org/github/rcaneill/xnemogcm/blob/master/example/open_process_files.ipynb#process_nemo

atb299 commented 2 years ago

@rcaneill , thanks for letting me know! No rush on my part, but thanks for implementing this. I look forward to picking up the next release!