0

I have a netCDF files with 5 coordinates but 3 dimensions :

xarray.Dataset {
dimensions: 
    rlat = 183 ;
    rlon = 182 ;
    time = 1 ;

coordinates:
    float32 lat(rlat, rlon) ;
    float32 lon(rlat, rlon) ;
    datetime64[ns] time (time) ;
    float32 rlat(rlat) ;
    float32 rlon(rlon) ;

variables:
    float32 CaPA_coarse_A_PR_SFC(time, rlat, rlon) ;
    float32 rotated_pole() ;

attributes:
    product = CaPA_coarse ;
    Conventions = CF-1.6 ;
    License = These data are provided by the Canadian Surface Prediction Archive CaSPar. You should have received a copy of the License agreement with the data. Otherwise you can find them under http://caspar-data.ca/doc/caspar_license.txt or email caspar.data@uwaterloo.ca. ;
    Remarks = Variable names are following the convention <Product>_<Type:A=Analysis,P=Prediction>_<ECCC name>_<Level/Tile/Category>. Variables with level '10000' are at surface level. The height [m] of variables with level '0XXXX' needs to be inferrred using the corresponding fields of geopotential height (GZ_0XXXX-GZ_10000). The variables UUC, VVC, UVC, and WDC are not modelled but inferred from UU and VV for convenience of the users. Precipitation (PR) is reported as 6-hr accumulations for CaPA_fine and CaPA_coarse. Precipitation (PR) are accumulations since beginning of the forecast for GEPS, GDPS, REPS, RDPS, HRDPS, and CaLDAS.}

I would use lon/lat coordinates instead of rlat/rlon but I don't know how !

I've tried to reprojected the netCDF file in WGS84 with epsg code 4326 but I don't know which projection to use in input.

Meiko
  • 3
  • 1

1 Answers1

1

You will need to regrid the data. There are a few options for doing this. You could try my package nctoolkit, which will use CDO to do the regridding. I suspect the grid will be compatible based on the info. The code below will regrid to a regular 1x1 degree grid globally.

import nctoolkit as
ds = nc.open_data(“foo.nc”)
ds.to_latlon(lon = [-179.5,179.5], lat = [-89.5, 89.5], res = 1)
ds.plot()
Robert Wilson
  • 3,192
  • 11
  • 19
  • 1
    Thank you very much! I had some trouble getting nctoolkit to work with my virtual environment but managed to find the right version combination! (cdo/1.9.8 and mpi4py/3.0.3) – Meiko Jun 19 '23 at 18:51