pyhcal 1.0.1__py3-none-any.whl → 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pyhcal/calibrators.py
CHANGED
|
@@ -271,7 +271,34 @@ class calibrator:
|
|
|
271
271
|
|
|
272
272
|
return df_agg
|
|
273
273
|
|
|
274
|
-
def landcover(
|
|
274
|
+
def landcover(cal,constituent,ref_landcover = None):
|
|
275
|
+
def normalize_group(group, ref_landcover):
|
|
276
|
+
if ref_landcover in group['LSID'].to_list():
|
|
277
|
+
ref_value = group.loc[group['LSID'] == ref_landcover, 'mean'].values[0]
|
|
278
|
+
group['mean_norm'] = group['mean'] / ref_value
|
|
279
|
+
else:
|
|
280
|
+
group['mean_norm'] = pd.NA
|
|
281
|
+
return group
|
|
282
|
+
|
|
283
|
+
if ref_landcover is None:
|
|
284
|
+
ref_landcover = cal.targets['uci_name'][cal.targets['dom_lc']==1].values[0]
|
|
285
|
+
|
|
286
|
+
df = cal.model.hbns.get_perlnd_data(constituent)*2000 #tons/ac/yr to lbs/acr/year
|
|
287
|
+
df = df[(df.index >= cal.start_date) & (df.index <= cal.end_date)]
|
|
288
|
+
df = df.mean().rename('mean').to_frame()
|
|
289
|
+
df = pd.merge(df, cal.uci.opnid_dict['PERLND'], left_index = True,right_on='TOPFST', how='inner')
|
|
290
|
+
df_normalized = pd.concat([normalize_group(group, ref_landcover) for _, group in list(df.groupby('metzone'))])
|
|
291
|
+
|
|
292
|
+
targets = cal.targets.set_index('uci_name')[constituent]
|
|
293
|
+
targets = targets/targets.loc[ref_landcover]
|
|
294
|
+
|
|
295
|
+
df_normalized['target'] = targets.loc[df_normalized['LSID']].values/df_normalized['mean_norm']
|
|
296
|
+
df_normalized = df_normalized.fillna(1) #don't make any changes to 0 concentration perlands
|
|
297
|
+
return df_normalized
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def landcover_legacy(self,constituent):
|
|
275
302
|
perlnd_names = self.model.uci.table('PERLND','GEN-INFO')['LSID']
|
|
276
303
|
df = self.model.hbns.get_perlnd_data(constituent)*2000 #tons/ac/yr to lbs/acr/year
|
|
277
304
|
df = df[(df.index >= self.start_date) & (df.index <= self.end_date)]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
pyhcal/__init__.py,sha256=4TEpGD-PfEY8yK-od8DpEMA4_iQ-q9y0PBvROXSPdB0,94
|
|
2
|
-
pyhcal/calibrators.py,sha256=
|
|
2
|
+
pyhcal/calibrators.py,sha256=O2m29Qat74g0AVPFABPoQXDCqosWqh1YBJfFdiWPdxU,31328
|
|
3
3
|
pyhcal/figures.py,sha256=Iu7LaN_i2IuDA_nfxj-a8AkG-FTLZVicJ3-efIs5OiE,45534
|
|
4
4
|
pyhcal/metrics.py,sha256=GUGHd-op-g1Foj8wnS_JVURSms4ifcC0a5h8ketQ29I,17911
|
|
5
5
|
pyhcal/modl_db.py,sha256=0NoWNNxfbF1fy43geOO4EJt-Uev6Og4Hw-KNn9xvAys,3163
|
|
@@ -9,6 +9,6 @@ pyhcal/data/HUC_Names.csv,sha256=UGmd3Q5E8DyFWggXzaXWpsRze7sFyrlpYqaYpMWAiGM,189
|
|
|
9
9
|
pyhcal/data/WISKI_EQUIS_XREF.csv,sha256=bPYq-f4-Qc6jsvUgl81lwXBeFamfDe5TjohqUV1XJlg,1244704
|
|
10
10
|
pyhcal/data/stations_EQUIS.gpkg,sha256=KyWMRbNoSSMDB1IweoLhyFeKu1P-YoYpQbXna6VYp8I,3284992
|
|
11
11
|
pyhcal/data/stations_wiski.gpkg,sha256=HlH5EwUo9qEEoxtbEpL0cJZHEW57XEUA-ROy4sN7eE4,892928
|
|
12
|
-
pyhcal-1.0.
|
|
13
|
-
pyhcal-1.0.
|
|
14
|
-
pyhcal-1.0.
|
|
12
|
+
pyhcal-1.0.2.dist-info/METADATA,sha256=WAKZkD6p_xoX6-cX3EM3d7-zFGO_ANJzlNvbSvozQFE,560
|
|
13
|
+
pyhcal-1.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
14
|
+
pyhcal-1.0.2.dist-info/RECORD,,
|
|
File without changes
|