Mdeshotel ngwpc 9713 wrf geo hydro meta#101
Conversation
mxkpp
left a comment
There was a problem hiding this comment.
This is a good start to the restructuring. Please see minor requested changes.
I compared diffs of the various business logic blocks that have been moved into the new inherited classes -- they look behaviorally equivalent to before.
For the hydrofabric case only, I tested by building and running a calibration realization after clearing my existing scratch dir.
NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/geoMod.py
Outdated
Show resolved
Hide resolved
| self.nx_local = None | ||
| self.ny_local = None | ||
| self.nx_local_elem = None | ||
| self.ny_local_elem = None |
There was a problem hiding this comment.
Some attrs were replaced with properties (like nx_local) but others have a new property and still are an attr as well, like nx_local_elem. Is the intent for all properties to not have a corresponding attr?
There was a problem hiding this comment.
The intent was to replace the attributes with properties. All 3 classes do not have a one to one match of attributes/properties. If a child class doesn't have one of the properties then is should be set as an attribute=None in the init. This was not done correctly when you reviewed but should now be corrected. Here is the original code for reference.
In summary:
- gridded: 6 properties; 0 attributes
- unstructured: 4 properties; 2 attributes=none
- hydrofabric: 2 properties; 4 attributes=None
NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/geoMod.py
Outdated
Show resolved
Hide resolved
NextGen_Forcings_Engine_BMI/NextGen_Forcings_Engine/core/geoMod.py
Outdated
Show resolved
Hide resolved
|
|
||
| # mpi_config.comm.barrier() | ||
|
|
||
| def calc_slope(self, esmf_nc): |
There was a problem hiding this comment.
Calls to calc_slope, calc_slope_unstructured, and calc_slope_gridded are malformed
|
|
||
| def initialize_geospatial_metadata(self, config_options, mpi_config): | ||
| """Initialize GeoMetaWrfHydro class variables. | ||
| def calc_slope_gridded(self, esmf_nc: netCDF4.Dataset) -> tuple: |
There was a problem hiding this comment.
The most recent commit removed esmf_nc = netCDF4.Dataset(self.config_options.geogrid, "r") from the top of calc_slope_gridded. Regardless of the var name, the original code was passing that var into this function and then replacing the object immediately with a read from disk. I think that behavior should be preserved, namely the step of reading from disk at the top of the function. I am not sure why the original code passes a variable in just to immediately replace it, but that aspect should probably be preserved too, for now.
There was a problem hiding this comment.
Same comment for other instances where the read netCDF4.Dataset(self.config_options.geogrid, "r") was recently removed, those should be reinstated.
First PR for refactoring GeoMetaWrfHydro. This PR splits GeoMetaWrfHydro into a base class with three children classes for "gridded", "hydrofabric", and "unstructured" grid types.
Additions
Removals
Changes
-This PR splits GeoMetaWrfHydro into a base class with three children classes for "gridded", "hydrofabric", and "unstructured" grid types.
-Update imports
-Update GeoMeta initiation code in bmi_model.py.
Testing
Screenshots
Notes
Todos
Checklist
Testing checklist
Target Environment support