Previous SAXO Documentation Assistant: Overview Next

Interpolation/

file_interp.pro

interpolate a NetCDF file from a grid to another (both regular or not)

file_interp Interpolation and NetCDF

file_interp, filein, fileout, gridout, GRIDIN=scalar string, MASKIN=scalar string, MASKOUT=scalar string, KEEP=string array, REMOVE=string array, METHOD=scalar string, SMOOTH=scalar 0 or 1, SET_XDIMNAME=scalar string, SET_YDIMNAME=scalar string, SET_XAXISNAME=scalar string, SET_YAXISNAME=scalar string, INMASKNAME=scalar string, ININVMASK=scalar: 0 or 1, INUSEASMASK=scalar string, INMISSING_VALUE=scalar, INADDSCL_BEFORE=scalar: 0 or 1, OUTMASKNAME=scalar string, OUTINVMASK=scalar: 0 or 1, OUTUSEASMASK=scalar string, OUTMISSING_VALUE=scalar, OUTADDSCL_BEFORE=scalar: 0 or 1, NAN_VALUE=scalar, WEIG=2d array or variable name, ADDR=2d array or variable name, INXAXISNAME=scalar string, INYAXISNAME=scalar string, OUTXAXISNAME=scalar string, OUTYAXISNAME=scalar string, _EXTRA=_EXTRA

Parameters

filein        in type: scalar string

input file name (must exist)

fileout        in type: scalar string

output file name (will be overwritten if already exist)

gridout        in type: scalar string

output grid file name (must exist and must contain the longitude and latitude axis as 1D or 2D arrays)

Keywords

GRIDIN        type: scalar string default: set to filein

define the input grid file name. It must exist and must contain the longitude and latitude axis as 1D or 2D arrays. Useful if filein file doesn't contain longitude and latitude axis

MASKIN        type: scalar string default: set to gridin

define the input mask file name. It must exist. The mask will be determided through ncdf_getmask according to the keywords inmaskname, ininvmask, inuseasmask, inmissing_value, inaddscl_before (see bellow)

MASKOUT        type: scalar string default: set to gridout

define the output mask file name. It must exist. The mask will be determided through ncdf_getmask according to the keywords outmaskname, outinvmask, outuseasmask, outmissing_value, outaddscl_before (see bellow)

KEEP        type: string array default: all variables

array defining the name of the variables that must be kept in the output file

REMOVE        type: string array default: empty

array defining the name of the variables that will be removed in the output file

METHOD        type: scalar string default: 'bilinear'

interpolation method: can be only 'bilinear' (or 'imoms3' if the iput grid is a "regular" grid). A "regular/rectangular grid" is defined as a grid for which each longitude lines have the same latitude and each latitude columns have the same longitude.

SMOOTH        type: scalar 0 or 1 default: 0

activate to use extrapsmooth instead of extrapolate when extrapolating input data over masked points.

SET_XDIMNAME        type: scalar string default: not used

used to defined the name of x dimension in filein input file when gridin keyword is used and when the x dimension name is not the same in filein and gridin files. By default, we assume both file have the same x dimension name.

SET_YDIMNAME        type: scalar string default: not used

same as set_xdimname but for y dimension

SET_XAXISNAME        type: scalar string default: not used

used to defined the name of the variable containing the x axis in filein input file when gridin keyword is used and when its variable containing the x axis name is not the same. By default, we assume both file have the same x axis name. Not that if filein includes x axis ther is no point to use gridin

SET_YAXISNAME        type: scalar string default: not used

same as set_xaxisname but for y dimension

INMASKNAME        type: scalar string default: not used

A string giving the name of the variable in the file maskin that contains the land/sea mask

ININVMASK        type: scalar: 0 or 1 default: 0

Inverse the land/sea mask of the input mask file maskin (that should have 0/1 values for land/sea)

INUSEASMASK        type: scalar string

A string giving the name of the variable in the input mask file maskin that will be used to build the land/sea mask. In this case the mask is based on the first record (if record dimension exists). The mask is build according to : 1 the keyword missing_value if existing 2 the attribute 'missing_value' if existing 3 NaN values if existing

INMISSING_VALUE        type: scalar

To define (or redefine if the attribute is already existing) the missing values used by INUSEASMASK keyword

INADDSCL_BEFORE        type: scalar: 0 or 1 default: 0

put 1 to apply add_offset ad scale factor on data before looking for missing values when using INUSEASMASK keyword

OUTMASKNAME        type: scalar string default: not used

same as inmaskname but for output mask file maskout

OUTINVMASK        type: scalar: 0 or 1 default: 0

same as ininvmask but for output mask file maskout

OUTUSEASMASK        type: scalar string

same as inuseasmask but for output mask file maskout

OUTMISSING_VALUE        type: scalar

same as inmissing_value but for output mask file maskout

OUTADDSCL_BEFORE        type: scalar: 0 or 1 default: 0

same as inaddscl_before but for output mask file maskout

NAN_VALUE        type: scalar default: not used

define the missing value in input data (missing values are treated like masked values and will be filled with extrapolation before interpolation).

WEIG        type: 2d array or variable name

(see ADDR)

ADDR        type: 2d array or variable name

1) at the first call of file_interp: This keyword can be set to a named variable (undefined or equal to 0) into which the addresses used to perform the interpolation will be copied when the current routine exits. 2) Next, once this keyword is set to a defined 2d array, it is used to bypass the computation of the weights and addresses used to perform the interpolation. In this case, interpolation is much faster

INXAXISNAME        type: scalar string default: 'x', 'longitude', 'nav_lon', 'lon', 'lon_rho' or 'NbLongitudes'

A string giving the name of the variable containning the x axis in the input grid file gridin

INYAXISNAME        type: scalar string default: 'y', 'latitude', 'nav_lat','lat', 'lat_rho' or 'NbLatitudes'

same as inxaxisname but for the y axis in the input grid file gridin

OUTXAXISNAME        type: scalar string default: 'x', 'longitude', 'nav_lon', 'lon', 'lon_rho' or 'NbLongitudes'

same as inxaxisname but for output grid file gridout

OUTYAXISNAME        type: scalar string default: 'y', 'latitude', 'nav_lat','lat', 'lat_rho' or 'NbLatitudes'

same as inyaxisname but for output grid file gridout

_EXTRA       

to use extrapolate, extrapsmooth and fromreg keywords

Examples


 IDL> file_interp, filein, fileout, gridout, inxaxisname = 'lo', inyaxisname = 'la', keep = ['lo', 'la', 'cond_sed']

 IDL> file_interp, in, out, gdout, inuseasmask = 'sst', inmissing_value = -1.00000e+30, nan_value = -1000.00

    

Version history

Version

$Id: file_interp.pro 283 2007-09-12 15:45:09Z smasson $

History

September 2007: Sebastien Masson (smasson@locean-ipsl.upmc.fr)

Known issues

Restrictions

- perform only horizontal interpolations on scalar fields - will fill all masked and missing values before interpolation - attributes (like valid_min...) are not updated - see restrictions of fromreg and fromirr

Other attributes

Uses routines

extrapsmooth, extrapolate, fromreg and fromirr

 


  Produced by IDLdoc 2.0.