JuliaClimate / meta

For discussions about JuliaClimate implementations
MIT License
6 stars 1 forks source link

CMIP data #17

Open briochemc opened 1 year ago

briochemc commented 1 year ago

Any recommended workflow for processing/analyzing CMIP data in Julia?

I thought I'd ask here for tips, which will undoubtedly be useful to me, and maybe help others too :)

Maybe this is all already answered somewhere and I just missed it, in which case sorry for the noise!

Alexander-Barth commented 1 year ago

dealing with inconsistencies between models

If you are using NCDatasets (NetCDF_jll should support Zarr), one can also index a dataset via the NetCDF standard name (assuming that this attribute is defined). If there is only one longitude NetCDF variable, then ds[CF"longitude"] should return it. For some model (like ROMS, a C-grid staggered model), there are different longitude arrays for different variables. To get the one associated (via shared dimension names) to e.g. "temp", one can use:

julia> ds["temp"][CF"longitude"]
lon_rho (150 × 94)
  Datatype:    Float64
  Dimensions:  xi_rho × eta_rho
  Attributes:
   long_name            = longitude of RHO-points
   units                = degree_east
   standard_name        = longitude
   field                = lon_rho, scalar

julia> ds["u"][CF"longitude"]
lon_u (149 × 94)
  Datatype:    Float64
  Dimensions:  xi_u × eta_u
  Attributes:
   long_name            = longitude of U-points
   units                = degree_east
   standard_name        = longitude
   field                = lon_u, scalar

Maybe this helps...

briochemc commented 1 year ago

@Alexander-Barth I'm not sure how to use NCDatasets here. Do you have a MWE of using NCDatasets to grab a variable from a CMIP dataset in the cloud?

Alexander-Barth commented 1 year ago

Unfortunately, I don't have a MWE, just the general information here: https://docs.unidata.ucar.edu/nug/current/nczarr_head.html

Note however, NetCDF_jll does not jet have S3 supported activated. Ref: https://github.com/JuliaPackaging/Yggdrasil/issues/6192

Balinus commented 1 year ago

I don't have code nearby, but I had success in the past using Zarr and YAXArray :

https://juliadatacubes.github.io/YAXArrays.jl/dev/examples/generated/UserGuide/openZarr/