Project

General

Profile

cdo interpolation question (lon-lat to orca025 grid)

Added by jigwang kim over 5 years ago

hello. my name jigwang kim.

I would like to make the "DFS"data of the lon-lat grid a grid of orca025. (lon-lat to orca025 interpolation)

I have a mesh_mask.nc of orca025, DFS of lon-lat data, weights files of orca025.

How can i make it?

thank you for your consideration.

I look forward to hearing from you.


Replies (12)

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by Karin Meier-Fleischer over 5 years ago

Hi Jigwang,

first, have a look at the Tutorial and FAQ section at the wiki page, e.g. https://code.mpimet.mpg.de/projects/cdo/wiki/FAQ#How-can-I-remap-my-data-to-a-different-grid-of-another-data-file.

You can remap your DFS latlon file to orca025 grid using the mesh_mask.nc file by

remapbil,mesh_mask.nc DFS.nc outpfile.nc

Do you want to mask the file? What does the mask file look like? See Tutorial item https://code.mpimet.mpg.de/projects/cdo/wiki/Tutorial#Masking.

-Karin

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by jigwang kim about 5 years ago

Thanks you for your answer!!

very thank you!!

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by jigwang kim about 5 years ago

hi. Karin

I tried the above and got the following error
How should I handle this?

<ERROR message>
cdo remapbil,mesh_mask.nc drowned_u10_DFS5.2_y2003.nc outpfile.nc
setBaseTime : Unsupported TIMEUNIT: unknown!
Warning (find_time_vars) : Time variable >t< not found!

cdo remapbil (Abort): Unsupported target grid type (generic)!

I look forward to hearing from you.

thank you,

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by Karin Meier-Fleischer about 5 years ago

Hi Jigwang,

whithout the data you use it is not possible to help. Please upload the files.

-Karin

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by jigwang kim about 5 years ago

Hi, Karin

The mesh_mask file and DFS file are too large to upload. Can you tell me how to upload?

thank you

jigwang kim

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by Karin Meier-Fleischer about 5 years ago

Can you send the output of ncdump of both files, your source and your target grid file. CDO tells you that the target grid file has an unknown grid type. The ORCA files are not following the netCDF-CF convention but CDO so you have a few things to change in the target file.

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by jigwang kim about 5 years ago

Thanks you for your answer.

(1) mesh_mask.nc
ncdump -h mesh_mask.nc
netcdf mesh_mask {
dimensions:
x = 1442 ;
y = 1021 ;
z = 75 ;
t = UNLIMITED ; // (1 currently)
variables:
float nav_lon(y, x) ;
float nav_lat(y, x) ;
float nav_lev(z) ;
double time_counter(t) ;
byte tmask(t, z, y, x) ;
byte umask(t, z, y, x) ;
byte vmask(t, z, y, x) ;
byte fmask(t, z, y, x) ;
byte tmaskutil(t, y, x) ;
byte umaskutil(t, y, x) ;
byte vmaskutil(t, y, x) ;
byte fmaskutil(t, y, x) ;
float glamt(t, y, x) ;
float glamu(t, y, x) ;
float glamv(t, y, x) ;
float glamf(t, y, x) ;
float gphit(t, y, x) ;
float gphiu(t, y, x) ;
float gphiv(t, y, x) ;
float gphif(t, y, x) ;
double e1t(t, y, x) ;
double e1u(t, y, x) ;
double e1v(t, y, x) ;
double e1f(t, y, x) ;
double e2t(t, y, x) ;
double e2u(t, y, x) ;
double e2v(t, y, x) ;
double e2f(t, y, x) ;
double ff(t, y, x) ;
short mbathy(t, y, x) ;
double e3t(t, z, y, x) ;
double e3u(t, z, y, x) ;
double e3v(t, z, y, x) ;
double e3w(t, z, y, x) ;
float gdept(t, z, y, x) ;
float gdepu(t, z, y, x) ;
float gdepv(t, z, y, x) ;
float gdepw(t, z, y, x) ;
double gdept_0(t, z) ;
double gdepw_0(t, z) ;
double e3t_0(t, z) ;
double e3w_0(t, z) ;

// global attributes:
:file_name = "mesh_mask.nc" ;
:TimeStamp = "27/08/2019 22:18:18 +0900" ;}

(2) DFS
ncdump -h drowned_t2_DFS5.2_y2003.nc
netcdf drowned_t2_DFS5.2_y2003 {
dimensions:
lat0 = 256 ;
lon0 = 512 ;
time = UNLIMITED ; // (2920 currently)
variables:
float lat0(lat0) ;
lat0:units = "degrees_north" ;
lat0:valid_min = -89.46282f ;
lat0:valid_max = 89.46282f ;
float lon0(lon0) ;
lon0:units = "degrees_east" ;
lon0:valid_min = 0.f ;
lon0:valid_max = 359.2969f ;
float t2(time, lat0, lon0) ;
t2:long_name = "ERA-interim arctic correction (Brodeau et al. 2007), temperature at 2m" ;
t2:units = "K" ;
t2:_FillValue = -9999.f ;
t2:valid_range = 229.3303f, 311.3863f ;
double time(time) ;
time:units = "unknown" ;
time:valid_min = 0.125f ;
time:valid_max = 365.f ;

// global attributes:
:About = "File created by SOSIE interpolation environement, Laurent Brodeau, 2010, ()" ;
:NCO = "20130308" ;}

Please check,,,thank you (감사합니다.)

-jigwang kim

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by Karin Meier-Fleischer about 5 years ago

Can you upload the mesh_mask file or is it too large?

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by jigwang kim about 5 years ago

hi

The size of the "mesh_mask" file is 5 gigabyte,,,,

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by Karin Meier-Fleischer about 5 years ago

Select one variable from the mesh_mask.nc file depending to the (t,y,x) grid and use this file to remap the data after some additional changes.
E.g. variable glamt:

cdo selname,glamt mesh_mask.nc mask_file.nc

In the mask file the correct attributes for latitude and longitude are missing. Furthermore, time, latitude and longitude have the wrong coordinate variable names (time_counter, nav_lat, nav_lon instead of time, lat, lon). To correct these issues use NCO's ncrename and ncatted.

ncrename -O -v nav_lon,lon -v nav_lat,lat -d time_counter,time -v time_counter,time mask_file.nc tmp.nc
ncatted -O -a units,time,c,c,"seconds since 1870-01-01 00:00:00" \
           -a calendar,time,c,c,"standard" \
           -a long_name,time,c,c,"time" \
           -a standard_name,time,c,c,"time" \
           -a units,lon,c,c,"degrees_east" \
           -a long_name,lon,c,c,"longitude" \
           -a standard_name,lon,c,c,"longitude" \
           -a units,lat,c,c,"degrees_north" \
           -a long_name,lat,c,c,"latitude" \
           -a standard_name,lat,c,c,"latitude" \
           tmp.nc orca_grid.nc

Now, you should be able to remap the data.

remapbil,orca_grid.nc DFS.nc outpfile.nc

If this won't work, upload the mask_file.nc (only one variable (t,y,x)) and DFS.nc (only one timestep).

-Karin

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by jigwang kim about 5 years ago

Hi! Thank you for answer. 감사합니다.

As advised, I tried but failed.
Let's extract and upload the mesk(one variable) file and DFS file.

And,, I have a one more question,,,

We will try to convert from lon-lat to orca grid using "cdo remapdis, gird.txt input.nc output.nc".
The txt file we have is an orca2 txt file, and we want to create an orca025 grid txt file.

How to make it(orca 025 grid txt file), or is there a place to get orca025 grid txt file?

-jigwang

RE: cdo interpolation question (lon-lat to orca025 grid) - Added by Karin Meier-Fleischer about 5 years ago

Without any file it is not possible to help!

If you have an orca025 file use griddes operator to get the grid description.

    (1-12/12)