-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New DataRequest #81
New DataRequest #81
Conversation
This commit introduces the `DataRequestVariable` abstract base class and its concrete implementation `CMIP6DataRequestVariable`. The new classes use the `dataclass` decorator to automatically generate special methods like `__init__` and `__repr__`. The `DataRequestVariable` class outlines the necessary properties and methods that any variable class should implement. The `CMIP6DataRequestVariable` class is a concrete implementation for CMIP6 variables. Additionally, this commit includes methods for constructing `DataRequestVariable` instances from dictionaries and JSON files, as well as converting instances to dictionary representations. Unit tests for `CMIP6DataRequestVariable` have been added to ensure correct functionality.
Tests now fail at the integration level, which is what I had expected. |
…ting a data request
…hen constructing from the full DataRequest collection
This pull request includes significant updates to the testing configuration, dependency management, and the Testing Configuration:
Dependency Management:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome @pgierz. I have a headache but it's very nice. I cannot say I understood everything but I could more or less follow. There are no many suggestions from my side, more questions, than anything. Once the suggestions are addressed feel free to merge right away.
Co-authored-by: Miguel <[email protected]>
Co-authored-by: Miguel <[email protected]>
Rework of
DataRequest
This introduces new
DataRequest
,DataRequestVariable
, andDataRequestTable
classes. The old ones are copies directly from Ruby and are not very nice to work with.Here, we implement a generic abstract base class (
ABC
) forDataRequestVariable
. This allows us to define how aDataRequestVariable
should look like from thepymorize
Python side, without caring about how the information is ultimately extracted from the JSON tables.CMIP6DataRequestVariable
is the first direct implementation used for JSON tables. This has the key feature of allowing us to be flexible when new CMIP standards inevitably come out, for example with CMIP7.A
DataRequestVariable
therefore must implement certain properties and methods to be correctly recognised, otherwise you get PythonTypeError
s when subclassing.TODO List
DataRequestVariable
(and concreteCMIP6DataRequestVariable
)DataRequestTable
(and concreteCMIP6DataRequestTable
, specificallyCMIP6JSONDataRequestTable
-- yes, I want to build two subclass levels here, since it might happen in the future that the source of theDataRequestTable
isn't a JSON file. Maybe it's a HTTP request. Maybe it's a post-it note on the coffee machine. I don't know)DataRequest
(maybe namedDataRequestCollection
?) -- some gathering of variousVariable
s and/orTable
s into a bundle.Still to come
FlatTable
design (those parts that fit together with this)Copilot Summary
This pull request introduces a new abstract base class
DataRequestVariable
and its concrete implementationCMIP6DataRequestVariable
in thesrc/pymorize/data_request/variable.py
file. Additionally, it includes a unit test for theCMIP6DataRequestVariable
class intests/unit/test_drv.py
.Key changes include:
New Class Definitions:
src/pymorize/data_request/variable.py
:DataRequestVariable
abstract base class with various properties and methods to define a generic data request variable.CMIP6DataRequestVariable
class as a concrete implementation ofDataRequestVariable
for CMIP6 variables, utilizing thedataclass
decorator for automatic method generation.Unit Testing:
tests/unit/test_drv.py
:CMIP6DataRequestVariable
instance from a CMIP6 JSON table file.