Versions Compared

Key

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

...

Takes the integer part of the geopoints values and extracts a specified bit (or number of bits if a second number parameter is specified), where bit number 1 is the least significant bit (lsb). A single bit will always be returned as 1 or 0, regardless of its position in the integer. A group of bits will be treated as if the first bit is the least significant bit of the result.

A few examples from the `number' number version of this function illustrate .

To extract the 1st, 2nd and 3rd bits from a number separately:

how it works:

Code Block
languagepy
# To extract the 1st, 2nd and 3rd bits from a number separately:
n = 6 # in bit-form, this is `00000110' with the 

...

least significant bit at the right

...


flag = intbits (n, 1) # flag is now 0

...

flag = intbits (n, 2) # flag is now 1

...

flag = intbits (n, 3) # flag is now 1

...

# To extract the 1st and 2nd bits together to make a single number:

...


flag = intbits (n, 1, 2) # flag is now 2

...


# To extract the 2nd and 3rd bits together to make a single number:

...


flag = intbits (n, 2, 2) # flag is now 3

...

#To extract the 3rd and 4th bits together to make a single number:

...


flag = intbits (n, 3, 2) # flag is now 1

...

The number of bits available depends on the machine architecture and Metview's compilation options, but at the time of writing it should be 32. This function does not treat missing values differently from any other values (for efficiency with large datasets).

...

geopoints create_geo ( number )
geopoints create_geo ( number, string )
geopoints create_geo ( number, string, number )
geopoints create_geo
 ( number, string, number, list )
geopoints create_geo ( ... )

Creates a new geopoints variable with the given number of points, all set to default values and coordinates. It is intended that this function be used in conjunction with the set_xxx geopoints functions in order to populate the geopoints with data. If saved, the geopoints file will be in the `traditional' 6-column format. If another format is desired, supply a string as the second parameter, possible values being 'polar_vector ', 'xy_vector ', 'xyv ' and 'ncols'. If format 'ncols' is specified, then the number of value columns can be given as the third argument (default is 1). In this case, an optional fourth argument can be used to provide a list of names of the value columns.

...

Returns geopoints with the value of each 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. A geopoint with either latitude or longitude set to missing value will have a distance of missing value.


Anchor
filter
filter

geopoints filter ( geopoints,geopoints )

...

Generates a set of geopoints from a field. The first parameter must contain a single field. The field is interpolated for each position of 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 ). This function will return a missing value where the geopoints have missing lat/lon.


Anchor
latitudes
latitudes

vector latitudes ( geopoints )

...

Computes the mean of the geopoints. Missing values are bypassed in this calculation. If there are no valid values, then nil is returned.


Anchor

...

mask
mask

geopoints mask ( geopoints,list )

Creates a geopoints variable containing point values of 0 or 1 according to whether they are inside (1) or outside (0) a defined geographical area.

The list parameter must contain exactly four numbers representing a geographical area. These numbers should be in the order north, west, south and east (negative values for western and southern coordinates). Points with missing latitudes or longitudes are considered to be outside any area. See the documentation for the fieldset version of this function to see how to compose more complex regions than a simple rectangular area.


Anchor
nearest_gridpoint
nearest_gridpoint

geopoints nearest_gridpoint ( fieldset,geopoints[,string] )

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 locations are taken from the original geopoints, but whose values are those of the nearest gridpoints in the field to the geopoints given as a second parameter. By default, when the nearest gridpoint value is a missing value or the location is out of the grid area, 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). If an extra parameter 'valid' is added to the function call, then of the surrounding points, the nearest valid one is returned; geo_missing_value will still be returned if all the surrounding points are missing. This function will return a missing value where the geopoints have missing lat/lon.


Anchor
offset
offset

geopoints offset ( geopoints,number,number )
geopoints offset ( geopoints,list)

Modifies the locations of a set of geopoints by specified amounts. The offsets can be specified either as two separate numbers or as a 2-element list. The original geopoints variable is unaffected; the functions return a new variable.


Anchor
polar_vector
polar_vector

geopoints polar_vector ( geopoints, geopoints )

Combines two single-parameter geopoints variables into a polar vector style geopoints variable. The first represents speed, the second represents direction. Both input geopoints variables should contain the same number of points.


Anchor
remove_duplicates
remove_duplicates

geopoints remove_duplicates ( geopoints )

Returns a new geopoints variable that contains just one instance of any duplicate geopoint. Two geopoints are considered to be duplicates of each other if the files have the same format and the points have the same coordinates, height, date, time and values.


Anchor
remove_missing_latlons
remove_missing_latlons

geopoints remove_missing_latlons ( geopoints )

Returns a new geopoints variable that contains just the points that do not have missing latitudes or longitudes from the input geopoints variable.



Anchor
remove_missing_values
remove_missing_values

geopoints remove_missing_values ( geopoints )

Returns a new geopoints variable that contains just the non-missing values from the input geopoints variable. A geopoint is considered to be missing if either its value or value2 members are missing.


Anchor
set_latitudes
set_latitudes

Anchor
set_logitudes
set_logitudes

Anchor
set_levels
set_levels

Anchor
set_dates
set_dates

Anchor
set_stnids
set_stnids

Anchor
set_times
set_times

Anchor
set_values
set_values

geopoints set_latitudes

...

geopoints nearest_gridpoint ( fieldset,geopoints )

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 locations are from the original geopoints, but 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).

...

geopoints offset ( geopoints,number,number )
geopoints offset ( geopoints,list)

Modifies the locations of a set of geopoints by specified amounts. The offsets can be specified either as two separate numbers or as a 2-element list. The original geopoints variable is unaffected; the functions return a new variable.

...

geopoints polar_vector ( geopoints, geopoints )

Combines two single-parameter geopoints variables into a polar vector style geopoints variable. The first represents speed, the second represents direction. Both input geopoints variables should contain the same number of points.

...

geopoints remove_duplicates ( geopoints )

Returns a new geopoints variable that contains just one instance of any duplicate geopoint. Two geopoints are considered to be duplicates of each other if the files have the same format and the points have the same coordinates, height, date, time and values.

...

geopoints remove_missing_values ( geopoints )

Returns a new geopoints variable that contains just the non-missing values from the input geopoints variable. A geopoint is considered to be missing if either its value or value2 members are missing.

Anchorset_latitudesset_latitudes Anchorset_logitudesset_logitudes Anchorset_levelsset_levels Anchorset_datesset_dates Anchorset_stnidsset_stnids Anchorset_timesset_times Anchorset_valuesset_valuesgeopoints set_latitudes ( geopoints, number or vector or list )
geopoints set_longitudes ( geopoints, number or vector or list )
geopoints set_levels ( geopoints, number or vector or list )
geopoints set_dates ( geopoints, number or vector or list )
geopoints set_stnids ( geopoints, list )
geopoints set_times ( geopoints, number or vector or list )
geopoints geopoints set_valulongitudes  ( geopoints, number or vector or number or vector or list )
geopoints geopoints set_values levels ( geopoints, number or string, vector or list )
geopoints set_dates ( geopoints, number or vector or list )
geopoints set_stnids ( geopoints, list )
geopoints set_times ( geopoints, number or vector or list )
geopoints set_values ( geopoints, number or vector or list )
geopoints set_values ( geopoints, number or string, number or vector or list )

Returns a new geopoints variable with either its latitude, longitude, level, date, time, stnid, value, value2 or another value column modified.

All these functions take two or three parameters: first one must be a geopoints variable. If three parameters are given, the second should be either the index or name of the values column to update. The last parameter defines the new values, and can be a number, a vector or a list of numbers . (or dates, if set_dates()). If a number is given then all the corresponding values (latitude, longitude, level, or ...) are replaced by the given value.

...

list stnids ( geopoints )

Extracts the station id strings from all the geopoints and returns them as a list.

...

Extracts the station id strings from all the geopoints and returns them as a list. If a given point does not have a station id, then a nil will be returned in its place in the list.


Anchor
subsample
subsample

geopoints subsample ( geopoints, geopoints )

Returns a geopoints variable containing the same locations (latitude, longitude and height) as the second geopoints variable, but whose values are from the first geopoints variable (or a missing value if point not found in the first variable). Note that the resulting geopoints variable is sorted in the same way as performed by the geosort() function. This means that you need to be careful if performing functions between the results of a subsample() operation and another geopoints variable; if the locations in the two geopoints are the same, then you should geosort() the second geopoints beforehand. Points with missing latitudes or longitudes will still be in the output, but the rule is that such a point is defined not to be at the same location as another point, even if its lat/lon are also missing. Advice: remove missing lat/lon points using remove_missing_latlons() before using subsample() or geosort()

...

geopoints subsample ( geopoints, geopoints )

Returns a geopoints variable containing the same locations (latitude, longitude and height) as the second geopoints variable, but whose values are from the first geopoints variable (or a missing value if point not found in the first variable). Note that the resulting geopoints variable is sorted in the same way as performed by the geosort() function. This means that you need to be careful if performing functions between the results of a subsample() operation and another geopoints variable; if the locations in the two geopoints are the same, then you should geosort() the second geopoints beforehand.

You can use function remove_missing_values() if you need to get rid of the missing valued points in the returned geopoints variable.

...

Computes the sum of the geopoints. Missing values are bypassed in this calculation. If there are no valid values, then nil is returned.


Anchor
times
times

vector times ( geopoints )

Extracts the times of all the geopoints and returns them as a vector.


Anchor
values
values

vector or list values ( geopoints )
vector or list values ( geopoints, number )
vector or list values ( geopoints, string )

...