-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1269 from metno/1175-evaluation-of-uemep-output-i…
…n-pyaeroval Extract interface for gridded modeldata reader
- Loading branch information
Showing
8 changed files
with
211 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
import abc | ||
from typing import Iterator | ||
|
||
from pyaerocom.griddeddata import GriddedData | ||
|
||
|
||
class GriddedReader(abc.ABC): | ||
"""Abstract base class for griddel model reader used for collocation""" | ||
|
||
@property | ||
@abc.abstractmethod | ||
def data_id(self) -> str: | ||
""" | ||
Data ID of dataset | ||
""" | ||
pass | ||
|
||
@property | ||
@abc.abstractmethod | ||
def ts_types(self) -> Iterator[str]: | ||
""" | ||
List of available frequencies | ||
Raises | ||
------ | ||
AttributeError | ||
if :attr:`data_dir` is not set. | ||
Returns | ||
------- | ||
list | ||
list of available frequencies | ||
""" | ||
pass | ||
|
||
@property | ||
@abc.abstractmethod | ||
def years_avail(self) -> Iterator[str]: | ||
""" | ||
Years available in dataset | ||
""" | ||
pass | ||
|
||
@property | ||
@abc.abstractmethod | ||
def vars_provided(self) -> Iterator[str]: | ||
"""Variables provided by this dataset""" | ||
pass | ||
|
||
@abc.abstractmethod | ||
def has_var(self, var_name) -> bool: | ||
"""Check if variable is supported | ||
Parameters | ||
---------- | ||
var_name : str | ||
variable to be checked | ||
Returns | ||
------- | ||
bool | ||
""" | ||
pass | ||
|
||
@abc.abstractmethod | ||
def read_var(self, var_name, ts_type=None, **kwargs) -> GriddedData: | ||
"""Load data for given variable. | ||
Parameters | ||
---------- | ||
var_name : str | ||
Variable to be read | ||
ts_type : str | ||
Temporal resolution of data to read. Supported are | ||
"hourly", "daily", "monthly" , "yearly". | ||
Returns | ||
------- | ||
GriddedData | ||
""" | ||
pass |
Oops, something went wrong.