...
+ 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.
...
fieldset Anchor acos acos acos
( fieldset )
fieldset Anchor asin asin asin
( fieldset )
fieldset Anchor atan atan 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.
...
fieldset Anchor cos cos 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.
number Anchor count count count
( fieldset )
Returns the number of fields in a fieldset.
fieldset Anchor exp exp exp
( fieldset )
Returns the fieldset of the exponential of the input fieldset at each grid point. Missing values are retained, unaltered by the calculation.
fieldset Anchor float float 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).
...
fieldset Anchor int int 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.
...
fieldset Anchor integer integer 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.
...
fieldset Anchor log log 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.
fieldset Anchor log10 log10 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.
fieldset Anchor neg neg 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.
fieldset Anchor sgn sgn 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.
fieldset Anchor sin sin 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.
...
fieldset Anchor sqrt sqrt 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.
fieldset Anchor tan tan 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.
number or list Anchor accumulate accumulate 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.
number or list Anchor average average average
( fieldset )
...
To get the physically correct average value of a field, use the integrate()
function (which employs a cosine latitude weighting)
vector or list Anchor average_ew average_ew 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.
vector or list Anchor average_ns average_ns 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.
...
fieldset Anchor bitmap bitmap 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
.
number or list Anchor corr_a corr_a 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)))
fieldset Anchor coslat coslat 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.
fieldset Anchor covar covar covar
( fieldset,fieldset )
...
A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.
number or list Anchor covar_a covar_a 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.
...
list Anchor datainfo datainfo 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.
fieldset Anchor distance distance 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.
fieldset Anchor div div div
( fieldset,fieldset )
...
A missing value in either input fieldset will result in a missing value in the corresponding place in the output fieldset.
fieldset Anchor divergence divergence 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.
list Anchor find find 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]
...
fieldset Anchor first_derivative_x first_derivative_x 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.
...
fieldset Anchor geostrophic_wind_pl geostrophic_wind_pl geostrophic_wind_pl
(z: fieldset)
...
Warning |
---|
Please be aware that in versions before Metview 5.65.0 3 the resulting fields of
but instead of it the following order is produced:
At the moment, Metview 5.65.0 3 is only available at ECMWF ( as metview/dev)new. |
list grib_get (fieldset, list) Anchor grib_get grib_get list grib_get (fieldset, list, string)
...
If applied to a multi-field fieldset, then all fields are modified.
...
number Anchor gribsetbits gribsetbits 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.
...
fieldset indexes ( fieldset, vector ) Anchor indexes indexes
...
GRIB: 1,3,5,5
2,4,5,5
1,0,3,1
...
number or list Anchor integrate integrate 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)
number or list Anchor interpolate interpolate 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.
fieldset Anchor laplacian laplacian 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.
vector or list longitudes ( fieldset ) Anchor longitudes longitudes
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.
...
fieldset Anchor lookup lookup 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.
fieldset Anchor mask mask mask
( fieldset,list )
...
The resulting mask field can be used in the integrate() function.
fieldset Anchor max max max
( fieldset )
fieldset Anchor min min 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 .
...
number Anchor maxvalue maxvalue 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
.
...
matrix or list Anchor matrix matrix 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.
fieldset Anchor mean mean 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 :
...
fieldset Anchor mean_ew mean_ew 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.
...
fieldset Anchor merge merge 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.
...
fieldset Anchor mod mod 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:
number or list Anchor nearest_gridpoint nearest_gridpoint 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.
list Anchor nearest_gridpoint_info nearest_gridpoint_info 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
...
fieldset Anchor nobitmap nobitmap 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
.
...
fieldset Anchor pressure pressure 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".
...
fieldset Anchor rms rms rms
( fieldset )
...
y = rms(x)
y = sqrt(mean(x*x))
fieldset Anchor second_derivative_x second_derivative_x 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.
fieldset Anchor sinlat sinlat sinlat
( fieldset )
...
# Computes absolute vorticity from vorticity
omega = 2 * pi / 86400
coriolis = 2 * omega * sinlat(vort)
absvort = vort + coriolis
fieldset Anchor sort sort 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.
fieldset Anchor stdev stdev stdev
( fieldset )
...
y = stdev(x)
y = sqrt(mean(x*x)-mean(x)*mean(x))
y = sqrt(var(x))
...
number or list Anchor stdev_a stdev_a 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.
...
fieldset Anchor sum sum 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 :
number or list surrounding_points_indexes ( fieldset,list ) Anchor surrounding_points_indexes surrounding_points_indexes
number or list surrounding_points_indexes ( fieldset,number,number )
...
Missing values in the lnsp field are retained in the output fieldset.
fieldset Anchor unipressure unipressure 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.
fieldset Anchor unithickness unithickness 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.
fieldset Anchor univertint univertint univertint
( fieldset)
fieldset univertint
( fieldset, fieldset )
fieldset univertint
( fieldset, number )
fieldset univertint
( fieldset, fieldset, number )
fieldset univertint
( fieldset, fieldset, list)
...
f
is the fieldsetp
is the pressureg
is the acceleration of gravity (9.81 m/s2).
date or list valid_date ( fieldset ) Anchor valid_date valid_date
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.
...
vector or list values ( fieldset ) Anchor values values
...
y = var(x)
y = mean(x*x)-mean(x)*mean(x)
number or list Anchor var_a var_a 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.
...
fieldset Anchor vertint vertint vertint
( fieldset )
...