fews_py_wrapper.utils#

Functions

format_datetime(dt[, time_format])

Format a datetime object to a string suitable for FEWS web services.

convert_netcdf_zip_response_to_xarray(...)

Convert FEWS NetCDF content to xarray datasets.

format_time_args(*args)

Format a list of datetime arguments to strings suitable for web services.

get_function_arg_names(func)

Get the argument names of a function.

fews_py_wrapper.utils.format_datetime(dt, time_format='%Y-%m-%dT%H:%M:%SZ')[source]#

Format a datetime object to a string suitable for FEWS web services.

Parameters:
  • dt (datetime)

  • time_format (str)

Return type:

str

fews_py_wrapper.utils.convert_netcdf_zip_response_to_xarray(response_content)[source]#

Convert FEWS NetCDF content to xarray datasets.

ZIP responses are returned as one loaded dataset per NetCDF member, in the same order as the ZIP archive. The original ZIP member filename without the file extension is preserved in each dataset’s fews_zip_member_filename attribute. Single-file NetCDF responses are returned as a one-item list.

Parameters:

response_content (bytes)

Return type:

list[Dataset]

fews_py_wrapper.utils.format_time_args(*args)[source]#

Format a list of datetime arguments to strings suitable for web services.

Parameters:

args (None | datetime)

Return type:

list[None | str]

fews_py_wrapper.utils.get_function_arg_names(func)[source]#

Get the argument names of a function.

Parameters:

func (Callable[[...], Any])

Return type:

list[str]