Project

General

Profile

Regridding two files

Added by Frida Perez over 3 years ago

Hello,

I am currently attempting to get two datasets (different variables) on the same grid and possibly merging them into a single file.

So far I have tried:
cdo remapbil, sic_inverted1.nc sic_sub.nc remap1.nc

When I do this, the output file "remap1.nc" does not display anything in ncview. I also attempted using weights for the remapping.

cdo genbil,sic_sub.nc sit_inverted1.nc weights1.nc
cdo remap,sic_sub.nc,weights1.nc sit_inverted1.nc remapped1.nc

I have done this with "rempabic" as well.

*The grid information for the sit_inverted1.nc:
*gridtype = curvilinear
gridsize = 722500
datatype = float
xsize = 850
ysize = 850
xname = lon
xdimname = v
xlongname = "longitude"
xunits = "degrees_east"
yname = latitude
ydimname = u
ylongname = "longitude"
yunits = "degree_north"

*The grid information for the sic_sub.nc:
*gridtype = curvilinear
gridsize = 104912
xsize = 316
ysize = 332
xname = longitude
xdimname = xgrid
xlongname = "longitude"
xunits = "degrees_east"
yname = latitude
ydimname = ygrid
ylongname = "latitude"
yunits = "degrees_north"

How can I regrid properly and get the datasets to match and possibly merge them into one file for analysis? The time steps are the same and the end goal would be to perform some multiplication between the two variables.

Thanks,
Frida

mysicGridef (4.14 MB) mysicGridef grid information for sic_sub.nc
mysitGridef (9.69 MB) mysitGridef grid information for sit_inverted1.nc

Replies (8)

RE: Regridding two files - Added by Ralf Mueller over 3 years ago

hi Frida!
could you upload a single timestep of both files? the ability to merge/interpolate grids depends on the coordinate values,too. so having access to the files can help here

cheers
ralf

RE: Regridding two files - Added by Frida Perez over 3 years ago

Yes, of course.

Here are both files with a single timestep

Best,
Frida

RE: Regridding two files - Added by Ralf Mueller over 3 years ago

hi!

in sit_ts1.nc all longitude values are 0 - no regridding possible with this I think

sorry
ralf

RE: Regridding two files - Added by Frida Perez over 3 years ago

Hi Ralf,

Thanks for looking into this. Is it possible to regrid with the file before I inverted the latitudes (for sit_ts1)? I have attached new files. Although it seems one file has all "yvals" and the other all "xvals"...

Thanks Again,
Frida

RE: Regridding two files - Added by Ralf Mueller over 3 years ago

hi Frida!

netcdf sit_ts1 {
dimensions:
        time = UNLIMITED ; // (1 currently)
        v = 850 ;
        u = 850 ;
variables:
        double time(time) ;
                time:standard_name = "time" ;
                time:units = "days since 2000-01-01 00:00:00" ;
                time:calendar = "standard" ;
                time:axis = "T" ;
        float latitude(u, v) ;
                latitude:standard_name = "latitude" ;
                latitude:long_name = "longitude" ;
                latitude:units = "degree_north" ;
                latitude:_CoordinateAxisType = "Lat" ;
        float SIT(time, u, v) ;
                SIT:long_name = "sea ice thickness" ;
                SIT:units = "m" ;
                SIT:coordinates = "latitude" ; <<<<<<<<<<<<<<================================
                SIT:_FillValue = -2.147484e+09f ;
                SIT:missing_value = -2.147484e+09f ;
                SIT:Description = "SD_density= 340.0 ; SI_density=875.0 ; W_density=1024.0" ;


there is no longitude in this file - again now regridding :-\

cheers
ralf

RE: Regridding two files - Added by Frida Perez over 3 years ago

Hi,

I am coming back to this problem after some time and realised in the original file (sit_ts1.nc) there are two grids in one netcdf file:

*sit_ts1.nc

# gridID 1
#
gridtype  = generic
gridsize  = 2
xsize     = 2
#
# gridID 2
#
gridtype  = curvilinear
gridsize  = 722500
datatype  = float
xsize     = 850
ysize     = 850
yname     = latitude
ydimname  = u
ylongname = "longitude" 
yunits    = "degree_north" 
yvals     = -17.83746 -17.93572 -18.03382 -18.13173 -18.22946 -18.32702 -18.4244
            -18.5216 -18.61863 -18.71548 -18.81215 -18.90864 -19.00496 -19.10109

The other file has one grid:
*sic_ts1.nc

# gridID 1
#
gridtype  = curvilinear
gridsize  = 104912
xsize     = 316
ysize     = 332
xname     = longitude
xdimname  = xgrid
xlongname = "longitude" 
xunits    = "degrees_east" 
yname     = latitude
ydimname  = ygrid
ylongname = "latitude" 
yunits    = "degrees_north" 
xvals     = -42.2325696077326 -42.0510060843102 -41.868398639379 -41.6847419855967
            -41.5000308609321 -41.3142600304317 -41.1274242880268 -40.9395184583834
            -40.7505373987928 -40.5604760011054 -40.3693291937063 -40.1770919435349

It appears the lat and lon are 2D arrays, but in the first file is there a way in cdo to output one variable with both grid1 and grid2 so that I can keep all longitudes? I am hoping this will make the interpolation more feasible. When I output the variable of interest 'SIT', I indeed lose the first grid coordinates.

Here are the grid text files:
mysitGridef (2 grids)
mysicGridef

and the first tilmestep of both nc files:
sit_ts1.nc
sic_ts1.nc

I have looked around the forum and have not found anything relevant to my current issue. Please let me know if there are ways around this.
Much appreciated,
Frida

mysitGridef.txt (8.06 MB) mysitGridef.txt mysitGridef
mysicGridef.txt (4.14 MB) mysicGridef.txt mysicGridef
sic_ts1.nc (2.01 MB) sic_ts1.nc sic_ts1.nc
sit_ts1.nc (30.4 MB) sit_ts1.nc sit_ts1.nc

RE: Regridding two files - Added by Ralf Mueller over 3 years ago

hi Frida!

the second grid is just from the time bounds variable. it's not a problem for regridding, but the original issue is still presend: There is not longitude coordinate associated with the SIT variable:

 float SIT(time, u, v) ;
                SIT:long_name = "sea ice thickness" ;
                SIT:units = "m" ;
                SIT:coordinates = "latitude" ; # <<<<<<<< NO LONGITUDE!!!!
                SIT:_FillValue = -2.147484e+09f ;
                SIT:missing_value = -2.147484e+09f ;
                SIT:Description = "SD_density= 340.0 ; SI_density=875.0 ; W_density=1024.0" ;

u and v are only dimensions, so you cannot put sic and sit on the same grid:

        float SIC(time, ygrid, xgrid) ;
                SIC:standard_name = "sea_ice_area_fraction" ;
                SIC:long_name = "Passive Microwave Monthly Southern Hemisphere Sea Ice Concentration by Bootstrap algorithm with Goddard QC" ;
                SIC:units = "1" ;
                SIC:grid_mapping = "projection" ;
                SIC:coordinates = "latitude longitude" ;

You might consider contacting one of the authors given in the file

 :contact = "ctoh_products@legos.obs-mip.fr, florent.garnier@legos.obs-mip.fr, sara.fleury@legos.obs-mip.fr" 
There might be reasons for this missing coordinate, but as long as the grid is not present with all coordinates you won;t be able to interpolate SIC and SIT to a common grid, sorry

best wishes
ralf

RE: Regridding two files - Added by Frida Perez over 3 years ago

Okay, just wanted to make sure. Thanks again for your help Ralf!
Frida

    (1-8/8)