Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

+ Addition

- Subtraction

* Multiplication

/ Division

^ Power

 

 



The fieldsets returned by these boolean operators are boolean fieldsets (containing only 1 where result is true, 0 where it is false) :

> Larger Than

< Smaller Than

>= Larger or Equal

<= Smaller or Equal

= Equal

<> Not Equal

 


In all of the above operations, a missing value in one of the input fieldsets results in a corresponding missing value in the output fieldset.

 


fieldset ( fieldset op number )
fieldset ( number op fieldset )

Operations between fieldsets and numbers. op is any of the operations defined above. A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

 


geopoints ( fieldset op geopoints )
geopoints ( geopoints op fieldset )

Operations between fieldsets and geopoints. op is any of the operations defined above. Missing values, both in the fieldset and in the original geopoints variable result in a value of geo_missing_value.

...


fieldset ( fieldset and fieldset )
fieldset ( fieldset or fieldset )
fieldset ( not fieldset )

...

creates a fieldset c with values of 1 where the corresponding values of fieldset a and fieldset b are both non zero, and 0 otherwise. For an example of the use of boolean operators, see the mask function. A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

...


fieldset ( fieldset and number )
fieldset ( number or fieldset )

Boolean operations between fieldsets and numbers. See above. A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

...


geopoints ( fieldset and geopoints )
geopoints ( geopoints or fieldset )

Boolean operations between fieldsets and geopoints. See above.

 


fieldset ( fieldset & fieldset & ... )
fieldset ( nil & fieldset & ... )
fieldset ( fieldset & nil )
fieldset merge ( fieldset,fieldset,... )

Merge several fieldsets. The output is a fieldset with as many fields as the total number of fields in all merged fieldsets. Merging with the value nil does nothing, and is used to initialise when building a fieldset from nothing.

 


fieldset fieldset [ number ]
fieldset fieldset [ number,number ]
fieldset fieldset [ number,number,number ]

...

# copies fields 1, 5, 9, 13, 17 of x into y
Y = X[1,20,4]

...


fieldset fieldset [ vector ]

...

Returns the fieldset of the absolute value of the input fieldset at each grid point or spectral coefficient. Missing values are retained, unaltered by the calculation.

...


Anchor
acos
acos
fieldset acos ( fieldset )
Anchor
asin
asin
fieldset asin ( fieldset )
Anchor
atan
atan
fieldset atan ( fieldset )

Return the fieldset of the arc trigonometric function of the input fieldset at each grid point. Result is in radians. Missing values are retained, unaltered by the calculation.

...


Anchor
cos
cos
fieldset cos ( fieldset )

Returns the fieldset of the cosine of the input fieldset at each grid point. Input values must be in radians. Missing values are retained, unaltered by the calculation.

 


Anchor
count
count
number count ( fieldset )

Returns the number of fields in a fieldset.

 


Anchor
exp
exp
fieldset exp ( fieldset )

Returns the fieldset of the exponential of the input fieldset at each grid point. Missing values are retained, unaltered by the calculation.

 


Anchor
float
float
fieldset float ( fieldset, number)

Returns a fieldset with integer data converted into floating point data for more accurate computations. The second parameter is optional; if given it defines the number of bits used for packing the float values. If not given, the default value of 24 is used (unless function gribsetbits(number) has been called to set it).

...


Anchor
int
int
fieldset int ( fieldset )

Returns the fieldset of the integer part of the input fieldset at each grid point or spectral coefficient. Missing values are retained, unaltered by the calculation.

...


Anchor
integer
integer
fieldset integer ( fieldset )

Returns the fieldset of the integer part of the input fieldset at each grid point or spectral coefficient. This function modifies the resulting GRIB header to be of integer data type. Missing values are replaced with LONG_MAX. This function was used in Metview 3 to enable the plotting of certain types of satellite imagery.

...


Anchor
log
log
fieldset log ( fieldset )

Returns the fieldset of the natural log of the input fieldset at each grid point. Missing values are retained, unaltered by the calculation.

 


Anchor
log10
log10
fieldset log10 ( fieldset )

Returns the fieldset of the log base 10 of the input fieldset at each grid point. Missing values are retained, unaltered by the calculation.

 


Anchor
neg
neg
fieldset neg ( fieldset )

Returns the fieldset of the negative of the input fieldset at each grid point or spectral coefficient. The same as (- fieldset). Missing values are retained, unaltered by the calculation.

 


Anchor
sgn
sgn
fieldset sgn ( fieldset )

Returns the fieldset of the sign of the values of the input fieldset at each grid point or spectral coefficient : -1 for negative values, 1 for positive and 0 for null values. Missing values are retained, unaltered by the calculation.

 


Anchor
sin
sin
fieldset sin ( fieldset )

Returns the fieldset of the sine of the input fieldset at each grid point. Input fieldset must have values in radians. Missing values are retained, unaltered by the calculation.

...


Anchor
sqrt
sqrt
fieldset sqrt ( fieldset )

Returns the fieldset of the square root of the input fieldset at each grid point. Missing values are retained, unaltered by the calculation.

 


Anchor
tan
tan
fieldset tan ( fieldset )

Return the tangent of the input fieldset at each grid point. Input fieldset must have values in radians. Missing values are retained, unaltered by the calculation.

 


Anchor
accumulate
accumulate
number or list accumulate ( fieldset )

For each field in the fieldset, this function calculates the sum of all the values of the field. If there is only one field in the fieldset, a number is returned. Otherwise, a list of numbers is returned. Only non-missing values are considered in the calculation. If there are no valid values, the function returns nil for that field.

 


Anchor
average
average
number or list average ( fieldset )

...

To get the physically correct average value of a field, use the integrate() function (which employs a cosine latitude weighting) 


Anchor
average_ew
average_ew
vector or list average_ew ( fieldset,list,number )

...

For the above example, each value returned (representing the mean at latitude Lat ) is the mean of non-missing values in those grid points whose latitude coordinate is between Lat-1.25 and Lat+1.25 (1.25 is 2.5/2), i.e. within a latitude belt with width of 2.5 degrees, centered around Lat. 


Anchor
average_ns
average_ns
vector or list average_ns ( fieldset,list,number )

...

Returns the base dates (including the time components) of the given fields. If the fieldset has only one field, a date is returned; otherwise a list of dates is returned.

...


Anchor
bitmap
bitmap
fieldset bitmap (fieldset,number)
fieldset bitmap (fieldset,fieldset)

Returns a copy of the input fieldset (first argument) with zero or more of its values replaced with grib missing value indicators. If the second argument is a number, then any value equal to that number in the input fieldset is replaced with the missing value indicator. If the second argument is another fieldset with the same number of fields as the first fieldset, then the result takes the arrangement of missing values from the second fieldset. If the second argument is another fieldset with one field, the arrangement of missing values from that field are copied into all fields of the output fieldset. See also nobitmap .

 


Anchor
corr_a
corr_a
number or list corr_a ( fieldset,fieldset )
number or list corr_a ( fieldset,fieldset,list )

...

z = corr_a (x, y)
z = covar_a (x, y) / (sqrt(var_a(x)) * sqrt(var_a(y)))

 


Anchor
coslat
coslat
fieldset coslat ( fieldset )

For each field in the input fieldset, this function creates a field where each grid point has the value of the cosine of its latitude.

 


Anchor
covar
covar
fieldset covar ( fieldset,fieldset )

...

A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

 


Anchor
covar_a
covar_a
number or list covar_a ( fieldset,fieldset )
number or list covar_a ( fieldset,fieldset,list )

Computes the covariance of two fieldsets over a weighted area. The area, if specified, is a list of numbers representing North, West, South, East. If the area is not specified, the whole field will be used in the calculation. The result is a number for a single field, or a list for a multi-field fieldset.

...


Anchor
datainfo
datainfo
list datainfo ( fieldset )

...

Returns a fieldset with the value in each grid point being the direction computed from the given U and V fieldsets; the first input fieldset is assumed to be the East-West (U) component and the second the North-South (V) component. The resulting numbers are directions, in degrees clockwise from North, where a value of 0 represents a wind from the North and a value of 90 represents a wind from the East.

 


Anchor
distance
distance
fieldset distance ( fieldset,number,number )
fieldset distance ( fieldset,list )

Returns a fieldset with the value in each grid point being the distance in meters from the given geographical location. The location may be specified by supplying either two numbers (latitude and longitude respectively) or a 2-element list containing latitude and longitude in that order. The location should be specified in degrees.

 


Anchor
div
div
fieldset div ( fieldset,fieldset )

...

A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

 


Anchor
divergence
divergence
fieldset divergence (fx: fieldset, fy: fieldset)

...

Returns a fieldset with the specified number of copies of the field in the input fieldset. The input fieldset must contain only one field.

 


Anchor
find
find
list find ( fieldset,number )
list find ( fieldset,number,list )
list find ( fieldset,number,field )

...

    • if there is a third argument, and it is a list of four numbers (lat/long coordinates) defining a geographical area - [North,West,South,East] , the function returns a list of locations within that area where the fieldset values equal the input value
    • if there is a third argument, and it is a mask field, the function returns a list of locations within the area defined by the mask (ie, where the mask gridpoints are non-zero) where the fieldset values equal the input value.

 


list find ( fieldset,list )
list find ( fieldset,list,list )
list find ( fieldset,list,field )

...

    • if there is a third argument, and it is a list of four numbers (lat/long coordinates) defining a geographical area - [North,West,South,East] , returns a list of locations within that area where the field values are within the interval [a, b]
    • if there is a third argument, and it is a mask field, returns a list of locations within the area defined by the mask (ie, where the mask gridpoints are non-zero) where the fieldset values are within the interval [a, b]

...


Anchor
first_derivative_x
first_derivative_x
fieldset first_derivative_x (f: fieldset)

...

If the input fieldset has more than one field, the result is a list of lists, one for each field. Note that this function accumulates its results between fields in a fieldset.

...


Anchor
geostrophic_wind_pl
geostrophic_wind_pl
fieldset geostrophic_wind_pl (z: fieldset)

...

Warning

Please be aware that in versions before Metview 5.65.0 3 the resulting fields of gradient() appear in the wrong order.  The correct order should look like this:

[gradx_f1, grady_f1, gradx_f2, grady_f2, ....]

but instead of it the following order is produced:

[gradx_f1, gradx_f2,..., grady_f1, grady_f2, ....]

At the moment, Metview 5.65.0 3 is only available at ECMWF ( as metview/dev)new.



Anchor
grib_get
grib_get
list grib_get (fieldset, list)
list grib_get (fieldset, list, string)

...

If applied to a multi-field fieldset, then all fields are modified.

...


Anchor
gribsetbits
gribsetbits
number gribsetbits ( number )

This function sets the number of GRIB packing bits to the value given (eg 8, 10, 16), and returns the previously used internal value. This function is particularly useful when dealing with 10-bit satellite images as these require GRIB packing to be set to 10 bits.

...


Anchor
indexes
indexes
fieldset indexes ( fieldset, vector )

...

GRIB: 1,3,5,5
      2,4,5,5
      1,0,3,1

...



Anchor
integrate
integrate
number or list integrate ( fieldset )
number or list integrate ( fieldset,list )
number or list integrate ( fieldset,fieldset )

...

# Retrieve land-sea mask and interpolate to LL grid
lsm = retrieve(
   type : "an",
   date : -1,
   param : "lsm",
   grid : [1.5,1.5],
   levtype : "sfc"
)

# The following line forces the values to 0 or 1.
lsm = lsm > 0.5

# Now compute the average value on land and on sea
land = integrate(field, lsm)
sea = integrate(field, not lsm)

 


Anchor
interpolate
interpolate
number or list interpolate ( fieldset,list )
number or list interpolate ( fieldset,number,number )

Interpolate a fieldset at a given point. The method used is bilinear interpolation. If a list is given, it must contain two numbers - latitude and longitude. If two numbers are given, the first is the latitude, the second the longitude. The field must be a gridded field. If the fieldset has only one field, a number is returned; otherwise a list is returned. Where it is not possible to generate a sensible value due to lack of valid data in the fieldset, nil is returned. Note that a similar function, nearest_gridpoint() , also exists.

 


geopoints interpolate ( fieldset,geopoints )

Generates a set of geopoints from a field. The first field of the input fieldset is used. The field is interpolated for each position of the geopoints given as a second parameter. The method used is bilinear interpolation. The output geopoints take their date, time and level from the fieldset. Where it is not possible to generate a sensible value due to lack of valid data in the fieldset, the internal geopoints missing value is used (this value can be checked for with the built-in variable geo_missing_value or removed with the function remove_missing_values). Note that a similar function, nearest_gridpoint() , also exists.

 


Anchor
laplacian
laplacian
fieldset laplacian (f: fieldset)

...

This function returns the grid point latitudes as a vector. If the fieldset contains more than one field it returns a list of vectors. Each of these vectors contains as many elements as grid points in each field.

 


Anchor
longitudes
longitudes
vector or list longitudes ( fieldset )

This function returns the grid point longitudes as a vector. If the fieldset contains more than one field it returns a list of vectors. Each of these vectors contains as many elements as grid points in each field.

...


Anchor
lookup
lookup
fieldset lookup ( fieldset,fieldset )
fieldset lookup ( fieldset,list )

...

Any missing values in the first fieldset will cause the function to fail with a `value out of range' error message.

 


Anchor
mask
mask
fieldset mask ( fieldset,list )

...

The resulting mask field can be used in the integrate() function.

 


Anchor
max
max
fieldset max ( fieldset )
Anchor
min
min
fieldset min ( fieldset )

Returns the fieldset of maximum (minimum) value of the input fieldset at each grid point or spectral coefficient. A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

 


fieldset max ( fieldset,fieldset )
fieldset min ( fieldset,fieldset )

Returns the fieldset of maximum (minimum) value of the two input fieldsets at each grid point or spectral coefficient. A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.

 


fieldset max ( fieldset,number )
fieldset min ( fieldset,number )

Returns the fieldset of the maximum (minimum) of the number and the fieldset value at each grid point or spectral coefficient. Missing values in the input fieldset are transferred to the output fieldset.

 


geopoints max ( fieldset,geopoints )
geopoints min ( fieldset,geopoints )

Returns geopoints of maximum (minimum) of the fieldset value and the geopoint value at each grid point or spectral coefficient. Missing values, either in the fieldset or in the original geopoints variable, result in a value of geo_missing_value .

...


Anchor
maxvalue
maxvalue
number maxvalue ( fieldset )
number maxvalue ( fieldset,list )
number minvalue ( fieldset )
number minvalue ( fieldset,list )

Returns the maximum (minimum) value of all the values of all the fields of the fieldset. The versions that take a list as a second parameter require a geographical area (north, west, south, east); only points within this area will be included in the calculation. Only non-missing values are considered in the calculation. If there are no valid values, the function returns nil.

...


Anchor
matrix
matrix
matrix or list matrix ( fieldset )

Generates a matrix containing the values of the input field, or a list of matrices if there are more than one field in the fieldset. Only works with regular lat/long grids.

 


Anchor
mean
mean
fieldset mean ( fieldset )

Computes the mean field of a fieldset. A missing value in any field will result in a missing value in the corresponding place in the output fieldset. With n fields in the input fieldset, if xik is the ith value of the kth input field and yi is the ith value of the resulting field, the formula can be written :

...


Anchor
mean_ew
mean_ew
fieldset mean_ew ( fieldset )

Takes a fieldset as its parameter and computes the mean for each line of constant latitude. The result is a fieldset where the value at each point is the mean of all the points at that latitude. Missing values are excluded; if there are no valid values, then the grib missing value indicator will be returned for those points.

...


Anchor
merge
merge
fieldset merge ( fieldset,fieldset,... )

Merge several fieldsets. The same as the operator &. The output is a fieldset with as many fields as the total number of fields in all merged fieldsets. Merging with the value nil does nothing, and is used to initialise when building a fieldset from nothing.

...


Anchor
mod
mod
fieldset mod ( fieldset,fieldset )

...

With n fields in the input fieldsets, if xik, yik are the ith value of the kth input fieldsets and zi is the ith value of the resulting field:

 


Anchor
nearest_gridpoint
nearest_gridpoint
number or list nearest_gridpoint ( fieldset,list )
number or list nearest_gridpoint ( fieldset,number,number )
vector or list nearest_gridpoint ( fieldset,vector,vector )

...

Generates a set of geopoints from a field. The first field of the input fieldset is used. The result is a set of geopoints whose values are those of the nearest gridpoints in the field to the geopoints given as a second parameter. Where it is not possible to generate a sensible value due to lack of valid data in the fieldset, the internal geopoints missing value is used (this value can be checked for with the built-in variable geo_missing_value or removed with the function remove_missing_values). Note that a similar function, interpolate() , also exists.

 


Anchor
nearest_gridpoint_info
nearest_gridpoint_info
list nearest_gridpoint_info ( fieldset,list )
list nearest_gridpoint_info ( fieldset,number,number )

...

fs = read (strGribFile)
listdef = nearest_gridpoint_info(fs, 51.46, -1.33)
loop ngp in listdef
     print ("Value : ", ngp.value)
     print ("Latitude : ", ngp.latitude)
     print ("Longitude : ", ngp.longitude)
end loop

...


Anchor
nobitmap
nobitmap
fieldset nobitmap ( fieldset,number )

Returns a copy of the input fieldset (first argument) with all of its missing values replaced with the number specified by the second argument. See also bitmap .

...


Anchor
pressure
pressure
fieldset pressure ( fieldset )
fieldset pressure ( fieldset,number )
fieldset pressure ( fieldset,list )
fieldset pressure ( fieldset,fieldset )

...

The name of this function is derived from the fact that it creates a "round mask" or a "radius mask".

...


Anchor
rms
rms
fieldset rms ( fieldset )

...

y = rms(x)
y = sqrt(mean(x*x))

 


Anchor
second_derivative_x
second_derivative_x
fieldset second_derivative_x (f: fieldset)

...

Creates a new fieldset with all the fields' values replaced by those supplied. If supplied as a single vector, the values are set in all fields; if a list of vectors is supplied then there must be the same number of vectors as there are fields in the fieldset. The default behaviour is to produce an error if the input fieldset and vector have different numbers of values. If, however, a third parameter (set to the string 'resize') is passed to the function, the resulting fieldset will instead be resized to have the same number of values as the input vector - this can be useful when creating a new fieldset from a template. Missing values in the vector(s) are retained as missing values in the fieldset.

 


Anchor
sinlat
sinlat
fieldset sinlat ( fieldset )

...

# Computes absolute vorticity from vorticity
omega = 2 * pi / 86400
coriolis = 2 * omega * sinlat(vort)
absvort = vort + coriolis

 


Anchor
sort
sort
fieldset sort ( fieldset )
fieldset sort ( fieldset,string )
fieldset sort ( fieldset,list )
fieldset sort ( fieldset,string,string )
fieldset sort ( fieldset,list,string )
fieldset sort ( fieldset,list,list )

...

The third argument specifies a sorting direction. This can be a string (">" or "<") or a list ([">", "<", ">",...]). If it is a string, the sorting direction it specifies applies to all sorting keys specified in the second argument. If it is a list, then the second argument must also be a list with the same number of elements - the sorting directions apply to each sorting key specified.

 


Anchor
stdev
stdev
fieldset stdev ( fieldset )

...

y = stdev(x)
y = sqrt(mean(x*x)-mean(x)*mean(x))
y = sqrt(var(x))

...


Anchor
stdev_a
stdev_a
number or list stdev_a ( fieldset )
number or list stdev_a ( fieldset,list )

Computes the standard deviation over a weighted area. The area, if specified, is a list of numbers representing North, West, South, East. If the area is not specified, the whole field will be used in the calculation. The result is a number for a single field, or a list for a multi-field fieldset.

...


Anchor
sum
sum
fieldset sum ( fieldset )

Computes the sum of a fieldset. The result is a single-field fieldset. A missing value in any field will result in a missing value in the corresponding place in the output fieldset. With n fields in the input fieldset, if xik is the ith value of the kth input field and yi is the ith value of the resulting field, the formula can be written :

 


Anchor
surrounding_points_indexes
surrounding_points_indexes
number or list surrounding_points_indexes ( fieldset,list )
number or list surrounding_points_indexes ( fieldset,number,number )

...

Missing values in the lnsp field are retained in the output fieldset.

 


Anchor
unipressure
unipressure
fieldset unipressure ( fieldset )
fieldset unipressure ( fieldset,fieldset )
fieldset unipressure ( fieldset,list )
fieldset unipressure ( fieldset,number )
fieldset unipressure ( fieldset,fieldset,number )
fieldset unipressure ( fieldset,list,number )

...

Missing values in the lnsp field are retained in the output fieldset.

 


Anchor
unithickness
unithickness
fieldset unithickness ( fieldset )
fieldset unithickness ( fieldset,fieldset )
fieldset unithickness ( fieldset,list )
fieldset unithickness ( fieldset,number )
fieldset unithickness ( fieldset,fieldset,number )
fieldset unithickness ( fieldset,list,number )

...

Missing values in the lnsp field are retained in the output fieldset.

 


Anchor
univertint
univertint
fieldset univertint ( fieldset)
fieldset univertint ( fieldset, fieldset )
fieldset univertint ( fieldset, number )
fieldset univertint ( fieldset, fieldset, number )
fieldset univertint ( fieldset, fieldset, list)

...

    • f is the fieldset
    • p is the pressure
    • g is the acceleration of gravity (9.81 m/s2).

 


Anchor
valid_date
valid_date
date or list valid_date ( fieldset )

Returns the valid dates (including the time components) of the given fields. If the fieldset has only one field, a date is returned; otherwise a list of dates is returned.

...


Anchor
values
values
vector or list values ( fieldset )

...

y = var(x)
y = mean(x*x)-mean(x)*mean(x)

 


Anchor
var_a
var_a
number or list var_a ( fieldset )
number or list var_a ( fieldset,list )

Computes the variance over a weighted area. The area, if specified, is a list of numbers representing North, West, South, East. If the area is not specified, the whole field will be used in the calculation. The result is a number for a single field, or a list for a multi-field fieldset.

...


Anchor
vertint
vertint
fieldset vertint ( fieldset )

...