earth2studio.data
.datasource_to_file#
- earth2studio.data.datasource_to_file(file_name, source, time, variable, lead_time=array([0], dtype='timedelta64[h]'), backend='netcdf', chunks={'variable': 1}, dtype=None)[source]#
Utility function that can be used for building a local data store needed for an inference request. This file can then be used with the
earth2studio.data.DataArrayFile
data source to load data from file. This is useful when multiple runs of the same input data is needed.- Parameters:
file_name (str) – File name of output NetCDF
source (DataSource) – The original data source to fetch from
time (list[str] | list[datetime] | list[np.datetime64]) – List of time strings, datetimes or np.datetime64 (UTC)
variable (VariableArray) – Strings or list of strings that refer to variables to return
lead_time (LeadTimeArray, optional) – Lead times to fetch for each provided time, by default np.array(np.timedelta64(0, “h”))
backend (Literal["netcdf", "zarr"], optional) – Storage backend to save output file as, by default “netcdf”
chunks (dict[str, int], optional) – Chunk sizes along each dimension, by default {“variable”: 1}
dtype (np.dtype, optional) – Data type for storing data
- Return type:
None