Project

General

Profile

intlevel3d and interpolating the z axis

Added by Josh Butterworth about 5 years ago

Hi Guys,

I'm currently trying to interpolate some observational data onto the grid of my model outputs (both attached as well as my untouched observational data).

So I initially used remapbil to remap my lat/lon and I've had a read through older posts to find out that intlevel3d might be what I need to interpolate my depth axis (from 102 to 16).

However, I'm getting several errors when I run this function, which I think (know!) is because I'm confused about what 'icoordinates' I should be inputting?

Any clarification would be greatly appreciated.

Many thanks,

Josh

modeloutput.nc (83.2 KB) modeloutput.nc Model output data - grid that needs to be used as the base
remapbilobs.nc (556 KB) remapbilobs.nc Observational temperature data after cdo remapbil
obs.nc (25.3 MB) obs.nc Untouched observational temperature data.

Replies (9)

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

I realise that the remapped observations that I've uploaded had not been correctly remapped - I've corrected this already.

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

This is the code I'm using to currently try and remap the depth axis:

cdo intlevel3d,ocn_temp_mod.nc ocn_temp_obs_remap.nc ocn_temp_mod.nc ocn_temp_obs1.nc

It's saying now that I cannot have missing values in my ifile (ocn_temp_obs_remap). I will try and fill these and update.

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

Neither of my methods for filling missing values (cdo fillmiss; setmissval) seem to work either...

RE: intlevel3d and interpolating the z axis - Added by Karin Meier-Fleischer about 5 years ago

Hi Josh,

its a little bit confusing, now. Could you explain (and upload) which file is the source file for 3d vertical coordinates variable and which file is the target file containing the 3d height levels, and which file is the real input data file (with the same 3d vertical coordinates variable as in the source file).

cdo intlevel3d,icoordinate infile1 infile2 outfile

icoordinate contains a single 3d variable, which represents the input 3d vertical coordinate
infile1     contains the source data, which the vertical coordinate from icoordinate belongs to
infile2     only contains the target 3d height levels

-Karin

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

Karin Meier-Fleischer wrote:

Hi Josh,

its a little bit confusing, now. Could you explain (and upload) which file is the source file for 3d vertical coordinates variable and which file is the target file containing the 3d height levels, and which file is the real input data file (with the same 3d vertical coordinates variable as in the source file).

[...]

-Karin

Hi Karin,

Thanks for the reply. Due to my inexperience with all of the information in the files I'm hoping if I give you a bit of context, my goals may be clearer. So...

1. I downloaded observational data and ran a model to produce the files "obs.nc" and "modeloutput.nc".
2. The more coarse resolution file is my model so, I tried to do remapbil on my "obs.nc" to enable direct comparison between the two (for validation).
3. Remapbil worked and they are on the same horizontal grid now. However, the vertical grid is different. Observations contain 102 levels and model output 16.
4. Need to somehow interpolate the z axis of my "obs.nc" onto the vertical grid of "modeloutput.nc"

Now, I'm slightly confused by all of the input files you mention... I think my source file is "modeloutput.nc" as this is the one with the 'correct' number of vertical levels. The target file (the file I wish to interpolate?) is the "obs.nc"... and now I'm not sure where the 'real input data file' is as I am only working with two files... Maybe it is also the "modeloutput.nc"?

I hope this makes sense.. Thanks for trying..!

Josh

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

Do I need to use a function to extract the Z axis from one of my outputs in order to create infile2?

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

Hi again,

So my thinking is:

icoordinates = ocn_temp_obs.nc (102 depth levels)
infile1 = ocn_temp_obs.nc
infile2 = ocn_temp_mod.nc (16 depth levels)

I've attached the files. I run this now and it moans about missing values unfortunately!!

Cheers,

Josh

ocn_temp_mod.nc (83.2 KB) ocn_temp_mod.nc infile2 ?
ocn_temp_obs.nc (25.3 MB) ocn_temp_obs.nc icoordinates and infile1 ?

RE: intlevel3d and interpolating the z axis - Added by Josh Butterworth about 5 years ago

Here's an update. It seems to be working now, although the missing values and replacement values are messing it up.

$ cdo setmisstoc,-999 ocn_temp_obs.nc ocn_temp_obsmiss.nc
$ cdo setmisstoc: Processed 6609600 values from 1 variable over 1 timestep [0.14s 21MB]
$ cdo setmisstoc,-999 ocn_temp_mod.nc ocn_temp_modmiss.nc
$ cdo setmisstoc: Processed 20736 values from 1 variable over 1 timestep [0.01s 14MB]
$ cdo remapbil,ocn_temp_modmiss.nc ocn_temp_obsmiss.nc ocn_temp_obsmisshor.nc
$ SCRIP bilinear weights from lonlat (360x180) to lonlat (36x36) grid
$ cdo remapbil: Processed 6609600 values from 1 variable over 1 timestep [0.34s 21MB]
$ cdo intlevel3d,ocn_temp_obsmisshor.nc ocn_temp_obsmisshor.nc ocn_temp_modmiss.nc outfile.nc
$ cdo intlevel3d (Warning): Non monotonic zaxis!
$ cdo intlevel3d (Abort): Level -999 not found!

Apologies for making this thread so convoluted.

RE: intlevel3d and interpolating the z axis - Added by Karin Meier-Fleischer about 5 years ago

It's ok. Yesterday I run into the exactly same problem with the missing value. Why CDO is trying to use it as a level, I don't know.

-Karin

    (1-9/9)