-
Notifications
You must be signed in to change notification settings - Fork 5
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
Remove science components from framework #46
Conversation
- move components/component.py to component.py - move components/_utils/* to _utils/* - rename records.py to record.py - rename states.py to state.py
was based on former subpackage components also refactored test package to reflect the new organisation of the cm4twc package
Old *info* properties used to return references to the internal dictionaries used to define the components, which was dangerous because the user could modify them inadvertently, so they are replaced by *metadata* properties that return a string displaying the content of these dictionaries. In addition, *info* properties are kept for inwards/outwards (because required for Exchanger and Data/NullComponent), but they return a deep copy of the dictionaries to avoid accidentally modifying them internally.
Turn them into methods rather than properties, and add "requires" to them to be more explicit and to avoid confusion with SpaceDomain properties (land_sea_mask and flow_direction).
Some tests are going to fail, these are due to changes in the construct access API in In fact tests have been failing for a while, but since the |
I am intentionally cancelling the testing workflow as we know they are going to fail, and they took 3 days to complete last time around. |
yaml.dump would return {} rather than an empty string or None, so here it will return None if the dictionary is empty
Since unifhy-org#46, the component contributions are expected to inherit not only the framework component classes, but their names as well (i.e. SurfaceLayerComponent, SubSurfaceComponent, OpenWaterComponent). When "printing" a Model instance, the information displayed became irrelevant, as the class name would not allow to tell which science component is actually being used. This is now fixed by displaying the full module name containing the component class.
resolve #45
The science components are removed from the package. The subpackage
components
only contained module component.py and its utils, so the module is moved to package root, and its utils are put with the other package utils.The existing science components now live in their own repositories:
The dummy components remain in the package to run the tests.
The documentation is updated to reflect the externalisation of the science components, including a review of the workflows to share science component contributions.
A template for component contribution now exists:
This PR also includes some API changes:
Component
et al. move fromcm4twc.components
tocm4twc.component
Component
class attributes_land_sea_mask
and_flow_direction
become class attributes_requires_land_sea_mask
and_requires_flow_direction
, respectivelyMetaComponent
class propertiesland_sea_mask
andflow_direction
become class methodsrequires_land_sea_mask()
andrequires_flow_direction()
MetaComponent
class properties to explore component's definition (e.g.inwards_info
,inputs_info
, etc.) becomeinwards_metadata
,inputs_metadata
, etc.