Skip to content

Commit

Permalink
address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Jun 18, 2024
1 parent 3294b0e commit 6c9702e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ravenpy/extractors/routing_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,11 @@ def keep_only_valid_downsubid_and_obs_nm(g):

return row

# Remove duplicate HRU_IDs while making sure that we keed relevant DowSubId and Obs_NM values
# Remove duplicate HRU_IDs while making sure that we keep relevant DowSubId and Obs_NM values
# FIXME: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns.
# This behavior is deprecated, and in a future version of pandas the grouping columns will be
# excluded from the operation. Either pass `include_groups=False` to exclude the groupings or
# explicitly select the grouping columns after groupby to silence this warning.
self._routing_data = self._routing_data.groupby(
self._routing_id_field, group_keys=False
).apply(keep_only_valid_downsubid_and_obs_nm)
Expand Down
13 changes: 9 additions & 4 deletions ravenpy/utilities/geo.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,15 @@ def generic_vector_reproject(
try:
geom = shape(feature["geometry"])
transformed = geom_transform(geom, source_crs, target_crs)
feature["geometry"] = fiona.Geometry().from_dict(
mapping(transformed)
)
sink.write(feature)
transformed_feature = {
"geometry": fiona.Geometry().from_dict(
mapping(transformed)
),
"properties": feature.__geo_interface__["properties"],
"id": feature.__geo_interface__["id"],
"type": feature.__geo_interface__["type"],
}
sink.write(transformed_feature)
except Exception as err:
LOGGER.exception(
f"{err}: Unable to reproject feature {feature}"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_nb_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_ts_fit_graph(self, get_local_testdata):
from xclim.indicators.generic import fit, stats

with xr.open_dataset(get_local_testdata(self.hydrographs)) as ds:
ts = stats(ds.q_sim.load(), op="max", freq="M")
ts = stats(ds.q_sim.load(), op="max", freq="ME")
with set_options(check_missing="skip"):
params = fit(ts, dist="gamma")
self.nbg.ts_fit_graph(ts, params)

0 comments on commit 6c9702e

Please sign in to comment.