<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

Interpolation/

file_interp.pro

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

topfile_interp Interpolation, 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, INTESTOP=scalar string, for example 'GT 0.5', OUTMASKNAME=scalar string, OUTINVMASK=scalar: 0 or 1, OUTUSEASMASK=scalar string, OUTMISSING_VALUE=scalar, OUTADDSCL_BEFORE=scalar: 0 or 1, OUTTESTOP=scalar string, for example 'GT 0.5', MISSING_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 determined through ncdf_getmask according to the keywords inmaskname, ininvmask, inuseasmask, inmissing_value, inaddscl_before (see below)

MASKOUT        type: scalar string default: set to gridout

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

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 input 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 there 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 that will be used to build the input land/sea mask. In this case the mask is based on the first record (if record dimension exists). The input mask is build according to operator defined by INTESTOP keyword (default NE) and the testing values defined as 1) the second word of TESTOP if existing 2) MISSING_VALUE keyword 3) attribute missing_value or _fillvalue of the variable USEASMASK 4) !Values.f_nan (can be used only with NE and EQ operators)

INMISSING_VALUE        type: scalar

To define (or redefine if the attribute is already existing) the missing values used with INUSEASMASK keyword to build the input mask. Note that this value is not used if INTESTOP keyword is given and contains 2 words. Note: do not mismatch with MISSING_VALUE used to detect missing values at reach record.

INADDSCL_BEFORE        type: scalar: 0 or 1 default: 0

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

INTESTOP        type: scalar string, for example 'GT 0.5' default: 'NE'

a string describing the type of test that will be done to define the input mask. The test is performed on the variable specified by INUSEASMASK keyword. INTESTOP can contain 1 or 2 words. The first word is the operator definition: "EQ" "NE" "GE" "GT" "LE" "LT" (default is NE). The second word define the testing value. If INTESTOP contains only 1 word, then the test value is denifed by 1) INMISSING_VALUE keyword 2) attribute missing_value or _fillvalue of the variable INUSEASMASK 3) !Values.f_nan (can be used only with NE and EQ operators)

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

OUTTESTOP        type: scalar string, for example 'GT 0.5' default: 'NE'

same as INTESTOP but for output mask file maskout

MISSING_VALUE        type: scalar default: defined by attribute missing_value or _fillvalue

(Re)define the missing value in input data (missing values are treated like masked values and will be filled with extrapolation before interpolation). Note: do not mismatch with (IN/OUT)MISSING_VALUE which are missing value used (in association with (IN/OUT)USEASMASK) to built the mask (that does not change from one record to another). Note: this value will be apply to all interpolated variables

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 containing 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, missing_value = -1000.00

Version history

Version

$Id: file_interp.pro 362 2008-07-29 09:00:03Z smasson $

History

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

Known issues

Restrictions

- perform only horizontal interpolations on scalar fields - all masked and missing values are filled before interpolation -> output data are not masked and have values everywhere. - attributes (like valid_min...) are not updated - see restrictions of fromreg and fromirr - output mask is not used but, if the input file contains the mask in a variable (defined by inmaskname), this variable will contain the output mask in the ouput file

Other attributes

Uses routines

Statistics

McCabe cyclic 69
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.