Skip to content
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 spacedomain vertical dimension #69

Merged

Conversation

ThibHlln
Copy link
Member

@ThibHlln ThibHlln commented Nov 15, 2021

resolve #28

Currently, depending on the user choise on defining/not defining a vertical dimension in their SpaceDomain, 2D or 3D arrays are sent to the components, which is problematic from a component contributor perspective because they don't know a priori what is the shape of the domain they need to work on, and they may not even want to work with the vertical dimension at all. There needs to be a way for the contributor to specify the space domains they support, and until then, this 2D/3D mismatch needs to be prevented by limiting to 2D domains.

Moreover, inherently horizontal properties of SpaceDomain (i.e. land_sea_mask, flow_direction, and cell_area) are not limited to 2D-only shapes. This also needs to be changed.

This PR includes:

  • the removal of the vertical dimension parameters (i.e. altitude) in the instantiation methods of Grid and its derived classes so that users cannot define 3D domains but only 2D domains
  • the enforcement of horizontal axes only in its properties land_sea_mask, flow_direction, and cell_area
  • the enforcement of horizontal axes only for the transfers through the Exchanger
  • the revision of the dummy components used in the tests to work with strict 2D domains

Note, while the user cannot define 3D grids anymore, the functionality to do so, which was perfectly functional, is kept in the source code, only vertical dimension related "entry points" are deactivated (i.e. commented out) to prevent the use of this functionality. This way, once 3D domains are properly supported, this can be brought back easily.

Thibault Hallouin added 29 commits November 3, 2021 16:46
The new constraint is that: "each component temporal resolution must be an integer multiple of the other components' resolutions".

So the time domain compatibility check in `Clock` is revised accordingly.

Also tests are added in the docstring to make sure that the check functions and remains functioning as expected.
The new constraint is that: "each component temporal resolution must be an integer multiple of the other components' resolutions".

So a space domain compatibility check in `Compass` is revised accordingly. The `Grid` is fitted with a new method `is_matched_in` to determine whether one grid is "contained" in another.

Also tests are added in the docstring to make sure that the check functions and remains functioning as expected.

Also new Grid method `is_matched_in` is added to the API reference.
This method is used in `Compass` without a check on type so this is a method that needs to be implemented for all `SpaceDomain`s.
…aints

The component temporal resolutions used to be {SL: daily, SS: 3daily, OW: 2daily}, but 3 is not a multiple of 2. They are now {SL: daily, SS: 4daily, OW:2daily}. The simulation period is also extended to 16 days, so that each spin up period is half of the simulation period.

The component spatial resolutions used to be {SL: 1deg, SS: 0.5deg, OW: 0.2deg}, but 0.5 is not a multiple of 0.2. They are now {SL: 1deg, SS: 0.5deg, OW:0.25deg}.

The expected records needed to be modified to take into account these modifications. These were manually calculated, and then compared against the results using the framework to make sure these new values are robust - they are essential because they form the basis for checking that the framework has not been broken.

The input files and the substitute data files needed to also be modified to comply with the resolutions and temporal extent changes.

The YAML configuration files are also modified to reflect the changes in the tests themselves.
Since `cfdm` and `cf-python` have dropped support for python 3.6, we need to follow. End of support for it is near anyway (2021-12-23 https://www.python.org/downloads/).
and implement them for `Grid`.

The method `has_vertical_axis` is to distinguish 3D from 2D space domains.
The property `vertical_axis` is to retrieve the axis name for the vertical dimension (e.g. 'Z' in a `Grid` context).
since the geometrical intersection between two volumes is a surface, the vertical dimension of the `SpaceDomain` should not be involved
since these 3 attributes of a space domain are physically only meaningful horizontally, even if `SpaceDomain` has a vertical axis.

So the compatibility check between the `SpaceDomain` and the data field is done on the horizontal `Grid` only, the data field is squeezed along Z, and the Z axis is dropped in the space shape of the processed data.
otherwise it would raise a quiet uninformative IndexError
this should have been included in the commit for unifhy-org#61
this avoids having an annoying warning message when compiling
While the vertical axis in `Grid` is perfectly functional, it should not be exposed through the API until 3D components are effectively supported (i.e. until contributors are able to tell the framework if they are expecting 2D fields or 3D fields or both).

Rather than deleting the functionality, comments have been used wherever needed to prevent users from creating a 3D `Grid`.  That involves:
- removing the parameters in instantiation methods,
- removing references to these parameters in docstrings, and
- removing Z related properties from API reference (even though these still exist, and in fact are still accessible but will return `None`).
@ThibHlln ThibHlln self-assigned this Nov 15, 2021
@ThibHlln ThibHlln changed the base branch from main to dev November 15, 2021 13:40
@ThibHlln ThibHlln linked an issue Nov 15, 2021 that may be closed by this pull request
@ThibHlln ThibHlln closed this Nov 15, 2021
@ThibHlln ThibHlln reopened this Nov 15, 2021
@ThibHlln ThibHlln changed the title Revise spacedomain vertical dimension Remove spacedomain vertical dimension Nov 15, 2021
@ThibHlln ThibHlln marked this pull request as ready for review November 15, 2021 15:34
@ThibHlln ThibHlln merged commit d3ab8bc into unifhy-org:dev Nov 15, 2021
@ThibHlln ThibHlln deleted the revise-spacedomain-vertical-dimension branch November 15, 2021 16:14
@ThibHlln ThibHlln mentioned this pull request Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review Z dimension for SpaceDomain
1 participant