Skip to content

Commit

Permalink
Merge pull request #256 from jmccreight/bug_snow_mass_err
Browse files Browse the repository at this point in the history
clean up some warnings
  • Loading branch information
jmccreight authored Nov 20, 2023
2 parents c0b256f + c54e064 commit be79e76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
7 changes: 0 additions & 7 deletions pywatershed/atmosphere/prms_atmosphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,7 @@ def __init__(
self._set_options(locals())

self._calculated = False

self._netcdf_initialized = False
if self._netcdf_output_dir:
self.initialize_netcdf(
output_dir=pl.Path(self._netcdf_output_dir),
separate_variables=self._netcdf_separate_files,
output_vars=self._netcdf_output_vars,
)

return

Expand Down
7 changes: 0 additions & 7 deletions pywatershed/atmosphere/prms_solar_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,7 @@ def __init__(
raise NotImplementedError()

self._calculated = False

self._netcdf_initialized = False
if self._netcdf_output_dir:
self.initialize_netcdf(
output_dir=pl.Path(self._netcdf_output_dir),
separate_variables=self._netcdf_separate_files,
output_vars=self._netcdf_output_vars,
)

return

Expand Down
22 changes: 12 additions & 10 deletions pywatershed/hydrology/prms_snow.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,12 @@ def _set_initial_conditions(self):
self.pk_depth,
)

self.pk_den = np.where(
mask_pkweq_gt_zero,
self.pkwater_equiv / self.pk_depth,
self.pk_den,
)
with np.errstate(invalid="ignore"):
self.pk_den = np.where(
mask_pkweq_gt_zero & (self.pk_depth > dnearzero),
self.pkwater_equiv / self.pk_depth,
self.pk_den,
)

self.pk_ice = np.where(
mask_pkweq_gt_zero, self.pkwater_equiv, self.pk_ice
Expand All @@ -377,11 +378,12 @@ def _set_initial_conditions(self):
)

mask_ai_gt_zero = self.ai > dnearzero
self.frac_swe = np.where(
mask_ai_gt_zero,
np.minimum(self.pkwater_equiv / self.ai, 1),
self.frac_swe,
)
with np.errstate(invalid="ignore"):
self.frac_swe = np.where(
mask_ai_gt_zero,
np.minimum(self.pkwater_equiv / self.ai, 1),
self.frac_swe,
)

wh_pkweq_gt_zero = np.where(mask_pkweq_gt_zero)
for ww in range(len(wh_pkweq_gt_zero[0])):
Expand Down

0 comments on commit be79e76

Please sign in to comment.