emodpy_malaria.weather.weather_request module

Weather service methods for submitting and working with weather data requests.

class emodpy_malaria.weather.weather_request.WeatherArgs(site_file: str | Path, start_date: int | str | datetime, end_date: int | str | datetime | None = None, node_column: str = 'node', lat_column: str = 'lat', lon_column: str = 'lon', id_reference: str = 'Default')[source]

Bases: object

Arguments defining weather request space and time scope.

validate()[source]

Validates: site file (exists, is readable, and it contains specified columns) and dates range.

class emodpy_malaria.weather.weather_request.RequestReport[source]

Bases: object

Specifies an object containing weather request operational reports.

download: Dict[str, List[str]] = None
class emodpy_malaria.weather.weather_request.DataSource(name: str | None = None)[source]

Bases: object

property name: str

Data source name property.

property file_prefix: str

Weather file prefix based on the current data source resolution.

property weather_variables: List[WeatherVariable]

List of weather variables supported by the current data source.

class emodpy_malaria.weather.weather_request.WeatherRequest(platform: str | COMPSPlatform, local_dir: str | None = None, data_source: str | None = None, is_staging: bool | None = None)[source]

Bases: object

Functionality for requesting and downloading weather files. Leverages idmtools API for COMPS SSMT.

property data_id: str

Expose asset collection id as interface data id property.

property local_dir: str

Local dir to/from where weather files will be downloaded.

property files: List[str]

List expected weather file paths.

property files_exist: bool

Returns True if all expected weather files exist in the local dir.

property report: RequestReport

Returns report object.

generate(weather_args: WeatherArgs, request_name: str | None = None, force: bool = False) WeatherRequest | None[source]

Submits the weather request and when data is ready sets the data_id property.

Parameters:
  • weather_args – Arguments defining space and time scope and weather files’ id reference.

  • request_name – (Optional) Name to be used for the weather SSMT work item.

  • force – (Optional) Force the download, even if target weather files already exist in the local dir.

Returns:

Returns this WeatherRequest object (to support method chaining).

download(data_id: str | None = None, local_dir: str | Path | None = None, force: bool = False) WeatherRequest[source]

Downloads weather files.

Parameters:
  • data_id – (Optional) Asset collection ID to be downloaded, even if not generated by this request.

  • local_dir – (Optional) Local dir where files will be downloaded. If not specified a temp dir is created.

  • force – (Optional) Force the download, even if target weather files already exist in the local dir.

Returns:

Returns this WeatherRequest object (to support method chaining).