-
Notifications
You must be signed in to change notification settings - Fork 2
adjustments to support gridded forcing #202
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
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,14 +2,15 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| # This is needed for get_var_bytes | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import gc | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import hashlib | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import os | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # time debugging | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import time | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from collections import defaultdict | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from datetime import datetime, timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| import logging | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from pathlib import Path | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| import netCDF4 as nc | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # import data_tools | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -68,15 +69,14 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ewts.helper import getenv_any | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| from ewts.logger import configure_existing_logger | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| FORCING_USE_EWTS = True | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| except ImportError: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| FORCING_USE_EWTS = False | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| class StdoutStyleFormatter(logging.Formatter): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| INFO_FORMAT = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "%(asctime)s %(name)-8s %(levelname)-7s %(message)s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| class StdoutStyleFormatter(logging.Formatter): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| INFO_FORMAT = "%(asctime)s %(name)-8s %(levelname)-7s %(message)s" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| DETAILED_FORMAT = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "%(asctime)s %(name)-8s %(levelname)-7s " | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -91,7 +91,7 @@ def format(self, record): | |||||||||||||||||||||||||||||||||||||||||||||||||||
| self._style._fmt = self.DETAILED_FORMAT | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| return super().format(record) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def formatTime(self, record, datefmt=None): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| dt = datetime.fromtimestamp(record.created, tz=timezone.utc) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return dt.strftime("%Y-%m-%dT%H:%M:%S.%f")[:-3] + "Z" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -108,6 +108,7 @@ def _configure_stdout_logging(): | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOG.propagate = False | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # If less than 0, then ESMF.__version__ is greater than 8.7.0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ESMF.version_compare("8.7.0", ESMF.__version__) < 0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| manager = ESMF.api.esmpymanager.Manager(endFlag=ESMF.constants.EndAction.KEEP_MPI) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -158,7 +159,9 @@ def __init__(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||
| configure_existing_logger(LOG) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| _configure_stdout_logging() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOG.warning("ewts package installed but EWTS_USE_NGEN_BRIDGE not on. Falling back to default logging.") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOG.warning( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "ewts package installed but EWTS_USE_NGEN_BRIDGE not on. Falling back to default logging." | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| _configure_stdout_logging() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -236,7 +239,6 @@ def initialize(self, config_file: str, output_path: str | None = None) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| :param config_file: The path to the configuration file for model initialization. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| :raises RuntimeError: If the configuration file is invalid or missing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOG.info("---------------------------") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOG.info( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"BMI Forcing Engine initializing with {config_file}{Pld(St.INITTING, modnm=MODNM)}" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -290,7 +292,7 @@ def initialize(self, config_file: str, output_path: str | None = None) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| # Initialize MPI communication | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._mpi_meta = MpiConfig(self._job_meta) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.geo_meta = HydrofabricGeoMeta(self._job_meta, self._mpi_meta) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.geo_meta = self.GeoMeta(self._job_meta, self._mpi_meta) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| try: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| comm = MPI.Comm.f2py(self._comm) if self._comm is not None else None | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -304,15 +306,7 @@ def initialize(self, config_file: str, output_path: str | None = None) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # LOG.debug(f"self._job_meta type: {type(self._job_meta)}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Call ESMF mesh creation process | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self._mpi_meta.rank == 0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat_ids = esmf_creation.create_mesh(self._job_meta) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat_count = np.array([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| len(cat_ids) if self._mpi_meta.rank == 0 else 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], dtype=np.intc) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._mpi_meta.comm.Bcast(cat_count, root=0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self._mpi_meta.rank != 0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat_ids = np.empty(cat_count[0], dtype=np.int64) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._mpi_meta.comm.Bcast(cat_ids, root=0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._values["CAT-ID"] = self.cat_ids | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Call forcing_extraction process | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self._job_meta.nwmConfig not in ["AORC", "NWM"]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -408,8 +402,6 @@ def initialize(self, config_file: str, output_path: str | None = None) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| # Set initial time, step, and true catchment IDs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._values["current_model_time"] = self.cfg_bmi["initial_time"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._values["time_step_size"] = self.cfg_bmi["time_step_seconds"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._values["CAT-ID"] = cat_ids | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Initialize the Forcings Engine model | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._model = NWMv3ForcingEngineModel() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -485,7 +477,10 @@ def _configure_output_path(self, output_path: str | None = None) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._output_obj.init_forcing_file( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._job_meta, self.geo_meta, self._mpi_meta, self._values["CAT-ID"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._job_meta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.geo_meta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._mpi_meta, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._values.get("CAT-ID"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason for |
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._output_configured = True | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -782,7 +777,7 @@ def get_value_ptr(self, var_name: str) -> NDArray[Any]: | |||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Ensure dtype is float64 (C double), except for CAT-ID | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if var_name == "CAT-ID": | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return arr # allow CAT-ID to pass on whatever the dtype is based on the input data | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return arr # allow CAT-ID to pass on whatever the dtype is based on the input data | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| elif arr.dtype != np.float64: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOG.warning( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| f"[BMI] Array for '{var_name}' has dtype {arr.dtype}, expected float64; converting." | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1637,6 +1632,7 @@ def __init__(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| super().__init__() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.GeoMeta = GriddedGeoMeta | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.cat_ids = None | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def grid_ranks(self) -> list[int]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Get the grid ranks for the gridded domain.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1665,7 +1661,7 @@ def set_var_names(self) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| # will support a BMI field for liquid fraction of precipitation | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._output_var_names = BMI_MODEL["_output_var_names"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._var_name_units_map = BMI_MODEL["_var_name_units_map"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self.config_options.include_lqfrac == 1: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self._job_meta.include_lqfrac == 1: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._output_var_names += ["LQFRAC_ELEMENT"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._var_name_units_map |= { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "LQFRAC_ELEMENT": ["Liquid Fraction of Precipitation", "%"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1704,6 +1700,20 @@ def __init__(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||
| super().__init__() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.GeoMeta = HydrofabricGeoMeta | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| @property | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| def cat_ids(self) -> NDArray[np.int_]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Get the catchment IDs for the hydrofabric domain.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self._mpi_meta.rank == 0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat_ids = esmf_creation.create_mesh(self._job_meta) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat_count = np.array( | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| [len(cat_ids) if self._mpi_meta.rank == 0 else 0], dtype=np.intc | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._mpi_meta.comm.Bcast(cat_count, root=0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if self._mpi_meta.rank != 0: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat_ids = np.empty(cat_count[0], dtype=np.int64) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self._mpi_meta.comm.Bcast(cat_ids, root=0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return cat_ids | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1703
to
+1715
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feels awkward as a property that non-hydrofabric models have to conform to. Maybe change this to a private method that gets overwritten.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def grid_ranks(self) -> list[int]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Get the grid ranks for the hydrofabric domain.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [self.grid_4.rank] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1765,6 +1775,7 @@ def __init__(self): | |||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| super().__init__() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.GeoMeta = UnstructuredGeoMeta | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| self.cat_ids = None | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| def grid_ranks(self) -> list[int]: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Get the grid ranks for the unstructured domain.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1858,12 +1869,14 @@ def set_var_names(self) -> None: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| self._grids = [self.grid_2, self.grid_3] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| BMIMODEL = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "gridded": NWMv3_Forcing_Engine_BMI_model_Gridded, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "unstructured": NWMv3_Forcing_Engine_BMI_model_Unstructured, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "hydrofabric": NWMv3_Forcing_Engine_BMI_model_HydroFabric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| class NWMv3_Forcing_Engine_BMI_model: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Factory class for creating instances of the NWMv3 Forcing Engine BMI model based on the specified grid type.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### NOTE patch so ngen always accesses the Hydrofabric child for now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ### Other discretization modes currently do not have a ngen workflow. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| NWMv3_Forcing_Engine_BMI_model = NWMv3_Forcing_Engine_BMI_model_HydroFabric | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| def __new__(cls, grid_type: str = "hydrofabric"): | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| """Create an instance of the NWMv3 Forcing Engine BMI model based on the specified grid type.""" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| bmi_model = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "gridded": NWMv3_Forcing_Engine_BMI_model_Gridded, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "unstructured": NWMv3_Forcing_Engine_BMI_model_Unstructured, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| "hydrofabric": NWMv3_Forcing_Engine_BMI_model_HydroFabric, | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| return bmi_model[grid_type]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| import argparse | ||
| from pathlib import Path | ||
| from types import SimpleNamespace | ||
| import numpy as np | ||
| import geopandas as gpd | ||
|
|
||
| import geopandas as gpd | ||
| import numpy as np | ||
| import yaml | ||
| from NextGen_Forcings_Engine.core.config import ConfigOptions | ||
|
|
||
|
|
@@ -29,8 +29,8 @@ def create_mesh(cfg: ConfigOptions): | |
| # The generation will sort the IDs, | ||
| # so return the sorted IDs from the geopackage | ||
| # to maintain the true->false ID indexing | ||
| hyfab = gpd.read_file(hyfab_name, layer='divides') | ||
| return np.sort(hyfab.div_id.values, copy=True, dtype=np.int64) | ||
| hyfab = gpd.read_file(hyfab_name, layer="divides") | ||
| return np.array(np.sort(hyfab.div_id.values), copy=True,dtype=np.int64) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old code converted to int and then sorted. The pending code sorts the raw values before converting to int. If the raw values are floats, the ordering within each integer range might be different before and after this change. I don't know if that matters or not, or the type of the raw Generally, this |
||
| return convert_hyfab_to_esmf(hyfab_gpkg=hyfab_name, esmf_mesh_output=mesh_out_path) | ||
|
|
||
|
|
||
|
|
||
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.