Skip to content

Commit

Permalink
Merge pull request #55 from SenteraLLC/POT-55-daily-wx
Browse files Browse the repository at this point in the history
[POT-55] - Support for meteomatics weather
  • Loading branch information
tnigon committed Mar 31, 2022
2 parents 5445768 + 92d72b8 commit f20e737
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 123 deletions.
15 changes: 14 additions & 1 deletion geoml/feature_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,19 @@ def _join_group_feats(self, df, group_feats, date_tolerance):
"wl_{0:.0f}".format(round(wl)) for wl in rast_metadata["wavelength"]
]
gdf_stats.rename(columns=dict(zip(bands, cols)), inplace=True)
# wl_min, wl_max = group_feats[key]
gdf_stats.rename(columns={"geom": "geom_rast"}, inplace=True)
wl_min, wl_max = group_feats[key]
wl_drop = []
for c in gdf_stats.columns:
try:
if (
int(c.split("_")[-1]) < wl_min
or int(c.split("_")[-1]) > wl_max
):
wl_drop.append(c)
except:
pass
gdf_stats.drop(columns=wl_drop, inplace=True)
subset = db_utils.get_primary_keys(self.df_response)
(
table_name_response,
Expand All @@ -366,6 +378,7 @@ def _join_group_feats(self, df, group_feats, date_tolerance):
how="left",
on=subset + ["date"] + subset_filter + [value_col],
)
# df["date"] = pd.to_datetime(df["date"].dt.date)
return df

def _load_df_response(self):
Expand Down
Loading

0 comments on commit f20e737

Please sign in to comment.