5

I am currently trying to use one NetCDF file (open-source data which can be downloaded from https://doi.pangaea.de/10.1594/PANGAEA.828650) to extract specific latitudes from this dataset (https://www.nodc.noaa.gov/archive/arc0105/0160558/3.3/data/0-data/spco2_1982-2015_MPI_SOM-FFN_v2016.nc, again open source).

The first dataset is defined regions of the global oceans known as biomes, I have successfully extracted the area which covers biomes labelled as 16 and 17 from this region.

This dataset has the following gridtype:

gridtype  = generic
gridsize  = 64800
xsize     = 180
ysize     = 360
xname     = lat
xunits    = "degrees latitude"
yname     = lon
yunits    = "degrees longitude"
xfirst    = -89.5
xinc      = 1
yfirst    = -179.5
yinc      = 1

The second grid type is a global dataset of ocean carbon fluxes (parameter: fgco2_raw) and I wish to extract values from the region defined by biome 16 and 17 in the Time_Varying_Biomes.nc.

This dataset, spco2_1982-2015_MPI_SOM-FFN_v2016.nc, has the following gridtype:

gridtype  = lonlat
gridsize  = 64800
datatype  = float
xsize     = 360
ysize     = 180
xname     = lon
xlongname = "longitude"
xunits    = "degrees_east"
yname     = lat
ylongname = "latitude"
yunits    = "degrees_north"
xfirst    = -179.5
xinc      = 1

When I have attempted to regrid Time_Varying doing the following:

cdo remapbil,mygridtype Time_Varying_Biomes.nc TVB_rg.nc

I have received this error:

cdo remapbil (Abort): Unsupported generic coordinates (Variable: MeanBiomes)!

Has anyone experienced this issue before, and do you have any idea on how I can fix it? Let me know if you need any further information to solve the problem.

Thanks in advance!

ClimateUnboxed
  • 7,106
  • 3
  • 41
  • 86
Ellie Nelson
  • 67
  • 1
  • 7

1 Answers1

5

You can solve this using the setgrid operator.

First create a grid file. This is the same as the one you give, but with "generic" replaced by "lonlat":

cdo griddes infile.nc > mygrid
sed -i "s/generic/lonlat/g" mygrid

Then use CDO to set the grid:

cdo setgrid,mygrid infile.nc infile_fixedgrid.nc

You should then be able to regrid the file.

Robert Wilson
  • 3,192
  • 11
  • 19
  • Hello, apologies I have one more question. I have noticed that the longitude and latitude coordinates on the Time_Varying_Biomes.nc dataset are on the wrong axis and as such are labelled incorrectly. When regridded this to second dataset the information in the biomes dataset gets rotated 90 degrees and therefore is incorrect. Best, Ellie – Ellie Nelson Jun 16 '21 at 09:05
  • You can invert latitudes using invertlat, though that doesn't sound like what you want – Robert Wilson Jun 16 '21 at 09:26
  • I think this is probably something I need to do with another programme as I am not sure it can be done in cdo. Thanks for your help! – Ellie Nelson Jun 16 '21 at 09:58