weather_request
Weather service methods for submitting and working with weather data requests.
DataSource
Source code in emodpy_malaria/weather/weather_request.py
file_prefix
property
Weather file prefix based on the current data source resolution.
name
property
Data source name property.
weather_variables
property
List of weather variables supported by the current data source.
__init__(name=None)
Initiate DataSource object based on name. If name is not provided the default is used.
Source code in emodpy_malaria/weather/weather_request.py
RequestReport
Specifies an object containing weather request operational reports.
Source code in emodpy_malaria/weather/weather_request.py
WeatherArgs
Arguments defining weather request space and time scope.
Source code in emodpy_malaria/weather/weather_request.py
__init__(site_file, start_date, end_date=None, node_column='node', lat_column='lat', lon_column='lon', id_reference=_META_DEFAULT_ID_REFERENCE)
Initializes and validates weather arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
site_file
|
Union[str, Path]
|
CSV (.csv) or demographics (.json) file containing a set of sites (points) defined with lat/lon. CSV file must contain columns for: EMOD node ids (node), latitude (lat) and longitude (lon). Demographics file must match EMOD demographics file schema. |
required |
start_date
|
Union[int, str, datetime]
|
Start date, in formats: year (2018), year and day-of-year (2018001) or date (20180101) |
required |
end_date
|
Union[int, str, datetime]
|
(Optional) End date, in formats: year (2018), year and day-of-year (2018365) or date (20181231) |
None
|
node_column
|
str
|
(Optional) Name of a column containing EMOD node ids. The default is "nodes". |
'node'
|
lat_column
|
str
|
(Optional) Name of a column containing site (point) latitude. |
'lat'
|
lon_column
|
str
|
(Optional) Name of a column containing site (point) longitude. |
'lon'
|
id_reference
|
str
|
(Optional) Value of weather metadata IdReference attribute. Default is "Default". |
_META_DEFAULT_ID_REFERENCE
|
Source code in emodpy_malaria/weather/weather_request.py
validate()
Validates: site file (exists, is readable, and it contains specified columns) and dates range.
Source code in emodpy_malaria/weather/weather_request.py
WeatherRequest
Functionality for requesting and downloading weather files. Leverages idmtools API for COMPS SSMT.
Source code in emodpy_malaria/weather/weather_request.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
data_id
property
writable
Expose asset collection id as interface data id property.
files
property
List expected weather file paths.
files_exist
property
Returns True if all expected weather files exist in the local dir.
local_dir
property
writable
Local dir to/from where weather files will be downloaded.
report
property
Returns report object.
__init__(platform, local_dir=None, data_source=None, is_staging=None)
Initializes a weather request per specified time-space, weather files and SSMT arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
platform
|
Union[str, COMPSPlatform]
|
SSMT platform name or COMPSPlatform object. Determined where the work item will run. |
required |
local_dir
|
str
|
(Optional) Local dir where files will be downloaded. If not specified a temp dir is created. |
None
|
data_source
|
str
|
(Optional) Data source name to be used by SSMT platform. |
None
|
is_staging
|
bool
|
(Optional) Flag determining weather image. By default, set based on the platform endpoint. |
None
|
Source code in emodpy_malaria/weather/weather_request.py
download(data_id=None, local_dir=None, force=False)
Downloads weather files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_id
|
str
|
(Optional) Asset collection ID to be downloaded, even if not generated by this request. |
None
|
local_dir
|
Union[str, Path]
|
(Optional) Local dir where files will be downloaded. If not specified a temp dir is created. |
None
|
force
|
bool
|
(Optional) Force the download, even if target weather files already exist in the local dir. |
False
|
Returns:
| Type | Description |
|---|---|
WeatherRequest
|
Returns this WeatherRequest object (to support method chaining). |
Source code in emodpy_malaria/weather/weather_request.py
generate(weather_args, request_name=None, force=False)
Submits the weather request and when data is ready sets the data_id property.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
weather_args
|
WeatherArgs
|
Arguments defining space and time scope and weather files' id reference. |
required |
request_name
|
str
|
(Optional) Name to be used for the weather SSMT work item. |
None
|
force
|
bool
|
(Optional) Force the download, even if target weather files already exist in the local dir. |
False
|
Returns:
| Type | Description |
|---|---|
Union[WeatherRequest, None]
|
Returns this WeatherRequest object (to support method chaining). |