add_data_from_arrays

s100py.s104.v2_0.utils.add_data_from_arrays(height, trend, data_file, grid_properties, datetime_value, data_coding_format, uncertainty=None)

Updates an S104File object with the supplied water level height and trend numpy.arrays.

Raises an S104Exception if the shapes of the water level height and trend (if not None) grids are not equal.

Parameters:
  • height (ndarray | Dataset) – 2d array containing water level heights

  • trend – 2d array containing water level trends

  • data_file – S104File object

  • grid_properties (dict) –

    a dictionary of metadata describing the grids passed in, metadata can have the following key/value pairs:

    • ”minx”: West bound longitude

    • ”maxx”: East bound longitude

    • ”miny”: South bound latitude

    • ”maxy”: North bound latitude

    • ”cellsize_x”: Only for DCF2, grid spacing longitude

    • ”cellsize_y”: Only for DCF2, grid spacing latitude

    • ”nx”: Only for DCF2, number of points longitudinal

    • ”ny”: Only for DCF2, number of points latitudinal

  • datetime_value – datetime object

  • data_coding_format

    • ‘Regularly-Gridded arrays’: 2

  • uncertainty – (Optional, default None) The value can be a 2d array containing water level uncertainty, a positive fixed float single value, or None, a 2d array will be inserted into the water level values compound dataset, a single value will be inserted into the water level features uncertainty dataset and if None an uncertainty dataset will be created with the fill value

Returns:

An S104File object updated by this function.

Return type:

data_file