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

bools as ints #95

Open
jmccreight opened this issue Jul 18, 2022 · 1 comment
Open

bools as ints #95

jmccreight opened this issue Jul 18, 2022 · 1 comment

Comments

@jmccreight
Copy link
Member

jmccreight commented Jul 18, 2022

These variables are really booleans but we are treating them as ints to be consistent with PRMS. This is happening in a translation step in meta.py that I'm removing, so I'm changing the types to int in the metadata/variables.yaml. These should eventually be changed to boolean in the metadata and handled as such. this list may not be comprehensive.

diff --git a/pynhm/static/metadata/variables.yaml b/pynhm/static/metadata/variables.yaml
index 17e075c..fdd19b3 100644
--- a/pynhm/static/metadata/variables.yaml
+++ b/pynhm/static/metadata/variables.yaml
@@ -1636,7 +1636,7 @@ iasw:
     on curve and maximum (1) or is on the defined curve (0)
   dimensions:
     0: nhru
-  type: bool
+  type: int32
   units: none
 imperv_evap:
   desc: Evaporation from impervious area for each HRU
@@ -1896,7 +1896,7 @@ lst:
     the albedo curve (1) (albset_snm or albset_sna) otherwise (0)
   dimensions:
     0: nhru
-  type: bool
+  type: int32
   units: none
 lwrad_net:
   desc: Net long-wave radiation for each HRU
@@ -2109,7 +2109,7 @@ pptmix_nopack:
     present on an HRU (1), otherwise (0)
   dimensions:
     0: nhru
-  type: bool
+  type: int32
   units: none
 precip:
   desc: Precipitation at each measurement station
jmccreight added a commit to jmccreight/pywatershed that referenced this issue Jul 18, 2022
@jmccreight
Copy link
Member Author

with this change:

index 2dca1a0..111b02a 100644
--- a/pynhm/base/meta.py
+++ b/pynhm/base/meta.py
@@ -63,7 +63,7 @@ def meta_numpy_type(meta_item: dict) -> str:
     if type_str == "int32":
         numpy_type_str = int
     elif type_str == "bool":
-        numpy_type_str = int
+        numpy_type_str = bool
     elif type_str == "float32":
         numpy_type_str = np.float32
     elif type_str == "float64":

these are in commit a075c9b

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

No branches or pull requests

1 participant