add_data_from_arrays

s100py.s111.v1_2.utils.add_data_from_arrays(speed, direction, data_file, grid_properties, datetime_value, data_coding_format)

Updates an S111File object based on numpy array/h5py datasets. Calls create_s111 then fills in the HDF5 datasets with the supplied speed and direction numpy.arrays.

Raises an S11Exception if the shapes of the speed and direction (if not None) grids are not equal.

Parameters:
  • speed (Union[ndarray, Dataset]) – 1d or 2d array containing surface current speeds.

  • direction (Union[ndarray, Dataset]) – 1d or 2d array containing surface current directions.

  • data_file – S111File object

  • datetime_value – datetime 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

    • ”latitude”: Only for DCF3, latitude of nodes

    • ”longitude”: Only for DCF3, longitudes of nodes

    • ”nodes”: Only for DCF3, number of nodes

  • data_coding_format

    • ‘Time series at fixed stations’: 1,

    • ’Regularly-gridded arrays’: 2,

    • ’Ungeorectified gridded arrays’: 3,

    • ’Time series data for one moving platform’: 4

    • ’Time Series at fixed stations (stationwise)’: 8

Returns:

An S111File object updated by this function.

Return type:

data_file