csep.load_gridded_forecast

csep.load_gridded_forecast(fname, loader=None, **kwargs)[source]

Loads grid based forecast from hard-disk.

The function loads the forecast provided with at the filepath defined by fname. The function attempts to understand the file format based on the extension of the filepath. Optionally, if loader function is provided, that function will be used to load the forecast. The loader function should return a csep.core.forecasts.GriddedForecast class with the region and magnitude members correctly assigned.

File extensions:

.dat -> CSEP ascii format .xml -> CSEP xml format (not yet implemented) .h5 -> CSEP hdf5 format (not yet implemented) .bin -> CSEP binary format (not yet implemented)

Parameters:
  • fname (str) – path of grid based forecast

  • loader (func) – function to load forecast in bespoke format needs to return csep.core.forecasts.GriddedForecast and first argument should be required and the filename of the forecast to load called as loader(func, **kwargs).

  • **kwargs – passed into loader function

Throws:

FileNotFoundError: when the file extension is not known and a loader is not provided. AttributeError: if loader is provided and is not callable.

Returns:

csep.core.forecasts.GriddedForecast