geoglows.streams

The functions in this module lookup metadata for rivers using a table of metadata about the GEOGLOWS model. This needs to be downloaded or it can be retrieved and cached by the metadata table function in the data module.

If you download the table in advance, you can specify it with the PYGEOGLOWS_METADATA_TABLE_PATH environment variable which will be checked at runtime. If it is not set, you need to restart the runtime or use the download function to retrieve it.

geoglows.streams.river_to_vpu(river_id: int, metadata_table_path: str = None) int[source]

Gives the VPU number for a given River ID number

Parameters:
  • river_id (int) – a 9 digit integer that is a valid GEOGLOWS River ID number

  • metadata_table_path (str) – optional path to the local metadata table

Returns:

a 3 digit integer that is the VPU number for the given River ID number

Return type:

int

geoglows.streams.latlon_to_river(lat: float, lon: float, metadata_table_path: str = None) int[source]

Gives the River ID number whose outlet is nearest the given lat and lon :param lat: a latitude :type lat: float :param lon: a longitude :type lon: float :param metadata_table_path: optional path to the local metadata table :type metadata_table_path: str

Returns:

a 9 digit integer that is a valid GEOGLOWS River ID number

Return type:

int

geoglows.streams.river_to_latlon(river_id: int, metadata_table_path: str = None) ndarray[source]

Gives the lat and lon of the outlet of the river with the given River ID number

Parameters:
  • river_id (int) – a 9 digit integer that is a valid GEOGLOWS River ID number

  • metadata_table_path (str) – optional path to the local metadata table

Returns:

a numpy array of floats, [lat, lon]

Return type:

np.ndarray