Versions Compared

Key

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

...

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.

An alternative, and more efficient way to create a new geopoints variable if you already have the data to populate it, is to provide a set of named arguments as shown in the examples below. Using this syntax, you can completely create a new geopoints variable with all its column data in one go. This is much more efficient than creating an empty geopoints variable and then populating it using the set_ functions.

Examples are shown below:

Code Block
languagepy
g = create_geo(8) # default geopoints format, 8 values
g = create_geo(9, 'xyv') # XYV formatted geopoints with 9 values
g = create_geo(4, 'ncols', 3, ['t', 'z', 'precip']) # NCOLS format with 3 named columns, each containing 4 values
g = create_geo(type:'standard',
               latitudes:  |4, 5, 6|,
               longitudes: |2.3, 1.1, 6.5|,
               levels:     850,  # all rows will have 850 as their level
               values:     |1.1, 2.2, 3.3|,
               times:      nil,
               stnids:     ['aberdeen', 'aviemore', 'edinburgh'] )
g = create_geo(type:'xyv',
               latitudes:  |4, 5, 6|,
               longitudes: |2.3, 1.1, 6.5|,
               values:     |1.1, 2.2, 3.3|)


list date ( geopoints )

Extracts the date information of all the geopoints and returns it as a list of dates.

...