Skip to content

Commit

Permalink
update region.geojson to fix test (#141)
Browse files Browse the repository at this point in the history
* region.geojson changed, whereas all other files remained equal ..

* point to correct write_xy

* fix black format

* call write_xy from hydromt.io directly

---------

Co-authored-by: Dirk Eilander <[email protected]>
  • Loading branch information
roeldegoede and DirkEilander authored Nov 9, 2023
1 parent cca9d19 commit 2b2bc18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions hydromt_sfincs/sfincs.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
import pandas as pd
import xarray as xr
from hydromt.models.model_grid import GridModel
from hydromt.raster import RasterDataArray
from hydromt.vector import GeoDataArray, GeoDataset
from hydromt.workflows.forcing import da_to_timedelta
from pyproj import CRS
from shapely.geometry import box, LineString, MultiLineString, Polygon
from shapely.geometry import box, LineString

from . import DATADIR, plots, utils, workflows
from .regulargrid import RegularGrid
Expand Down Expand Up @@ -2820,7 +2819,7 @@ def write_geoms(self, data_vars: Union[List, str] = None):
elif gname == "drn":
utils.write_drn(fn, gdf)
else:
utils.write_xy(fn, gdf, fmt="%8.2f")
hydromt.io.write_xy(fn, gdf, fmt="%8.2f")

# NOTE: all geoms are written to geojson files in a "gis" subfolder
if self._write_gis:
Expand Down Expand Up @@ -2978,7 +2977,7 @@ def write_forcing(self, data_vars: Union[List, str] = None):
self.set_config(f"{xy_name}file", f"sfincs.{xy_name}")
fn_xy = self.get_config(f"{xy_name}file", abs_path=True)
# write xy
utils.write_xy(fn_xy, gdf, fmt="%8.2f")
hydromt.io.write_xy(fn_xy, gdf, fmt="%8.2f")
if self._write_gis: # write geojson file to gis folder
self.write_vector(variables=f"forcing.{ts_names[0]}")

Expand Down
2 changes: 1 addition & 1 deletion hydromt_sfincs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"get_bounds_vector",
"mask2gdf",
"read_xy",
"write_xy",
"write_xy", # defined in hydromt.io
"read_xyn",
"write_xyn",
"read_geoms",
Expand Down
2 changes: 1 addition & 1 deletion tests/data/sfincs_test/gis/region.geojson
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::32633" } },
"features": [
{ "type": "Feature", "properties": { "value": 1.0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 325057.608460268122144, 5044274.933194775134325 ], [ 325324.910417524341028, 5044411.130344697274268 ], [ 325256.811842563271057, 5044544.781323325820267 ], [ 326593.321628844540101, 5045225.767072933726013 ], [ 326525.223053883470129, 5045359.418051562272012 ], [ 327594.430882908403873, 5045904.20665124990046 ], [ 327526.33230794739211, 5046037.85762987844646 ], [ 327927.285243831807747, 5046242.153354761190712 ], [ 327859.186668870737776, 5046375.804333388805389 ], [ 328661.092540639452636, 5046784.395783153362572 ], [ 328729.191115600522608, 5046650.744804525747895 ], [ 328862.842094228661153, 5046718.843379486352205 ], [ 328794.743519267591182, 5046852.494358113966882 ], [ 329195.696455151948612, 5047056.790082996711135 ], [ 327425.133506164595019, 5050531.7155273379758 ], [ 316198.451301402237732, 5044811.435230625793338 ], [ 317969.014250389591325, 5041336.509786284528673 ], [ 318770.920122158306185, 5041745.101236050017178 ], [ 318839.018697119376156, 5041611.450257422402501 ], [ 318972.669675747514702, 5041679.548832383006811 ], [ 318904.571100786444731, 5041813.199811010621488 ], [ 320107.429908439575229, 5042426.086985657922924 ], [ 320175.5284834006452, 5042292.436007030308247 ], [ 321779.340226938133128, 5043109.618906561285257 ], [ 321711.241651977063157, 5043243.269885188899934 ], [ 321844.892630605143495, 5043311.368460149504244 ], [ 321912.991205566213466, 5043177.717481521889567 ], [ 322581.246098706847988, 5043518.21035632584244 ], [ 322649.344673667859752, 5043384.559377697296441 ], [ 323317.599566808494274, 5043725.052252502180636 ], [ 323385.698141769564245, 5043591.401273873634636 ], [ 323920.302056282060221, 5043863.795573716983199 ], [ 323852.20348132099025, 5043997.446552345529199 ], [ 323985.854459949070588, 5044065.545127306133509 ], [ 324053.953034910140559, 5043931.894148677587509 ], [ 324989.509885307052173, 5044408.584173403680325 ], [ 325057.608460268122144, 5044274.933194775134325 ] ] ] } }
{ "type": "Feature", "properties": { "value": 1.0 }, "geometry": { "type": "Polygon", "coordinates": [ [ [ 325057.608460268122144, 5044274.933194775134325 ], [ 324989.509885307052173, 5044408.584173403680325 ], [ 324053.953034910140559, 5043931.894148677587509 ], [ 323985.854459949070588, 5044065.545127306133509 ], [ 323852.20348132099025, 5043997.446552345529199 ], [ 323920.302056282060221, 5043863.795573716983199 ], [ 323385.698141769564245, 5043591.401273873634636 ], [ 323317.599566808494274, 5043725.052252502180636 ], [ 322649.344673667859752, 5043384.559377697296441 ], [ 322581.246098706847988, 5043518.21035632584244 ], [ 321912.991205566213466, 5043177.717481521889567 ], [ 321844.892630605143495, 5043311.368460149504244 ], [ 321711.241651977063157, 5043243.269885188899934 ], [ 321779.340226938133128, 5043109.618906561285257 ], [ 320175.5284834006452, 5042292.436007030308247 ], [ 320107.429908439575229, 5042426.086985657922924 ], [ 318904.571100786444731, 5041813.199811010621488 ], [ 318972.669675747514702, 5041679.548832383006811 ], [ 318839.018697119376156, 5041611.450257422402501 ], [ 318770.920122158306185, 5041745.101236050017178 ], [ 317969.014250389591325, 5041336.509786284528673 ], [ 316198.451301402237732, 5044811.435230625793338 ], [ 327425.133506164595019, 5050531.7155273379758 ], [ 329195.696455151948612, 5047056.790082996711135 ], [ 328794.743519267591182, 5046852.494358113966882 ], [ 328862.842094228661153, 5046718.843379486352205 ], [ 328729.191115600522608, 5046650.744804525747895 ], [ 328661.092540639452636, 5046784.395783153362572 ], [ 327859.186668870737776, 5046375.804333388805389 ], [ 327927.285243831807747, 5046242.153354761190712 ], [ 327526.33230794739211, 5046037.85762987844646 ], [ 327594.430882908403873, 5045904.20665124990046 ], [ 326525.223053883470129, 5045359.418051562272012 ], [ 326593.321628844540101, 5045225.767072933726013 ], [ 325256.811842563271057, 5044544.781323325820267 ], [ 325324.910417524341028, 5044411.130344697274268 ], [ 325057.608460268122144, 5044274.933194775134325 ] ] ] } }
]
}

0 comments on commit 2b2bc18

Please sign in to comment.