Skip to content

Commit

Permalink
Update the logging in runner and dem (#235)
Browse files Browse the repository at this point in the history
* Update the logging in runner, dem, geometry, processor and bathymetry_estimation

* fixup: Format Python code with Black

* Cleaned up the YML files slightly

* Update benchmark

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
rosepearson and github-actions authored Jan 25, 2024
1 parent 84ef502 commit 1a3c6a5
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 160 deletions.
4 changes: 1 addition & 3 deletions environment_linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# YML file for setting up a virtual environment including packages used for processing point clouds, GIS and raster to produce raster using spyder.
# YML file for setting up a virtual environment capable of running GeoFabrics

name: geofabrics
channels:
Expand All @@ -20,5 +20,3 @@ dependencies:
- netcdf4
- geoapis >=0.3.2
- osmpythontools >=0.3.5

prefix: C:\ProgramData\Anaconda3\envs\geofabrics
4 changes: 1 addition & 3 deletions environment_windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# YML file for setting up a virtual environment including packages used for processing point clouds, GIS and raster to produce raster using spyder.
# YML file for setting up a virtual environment capable of running GeoFabrics. It includes packages used for processing point clouds, GIS and raster to produce raster using spyder.

name: geofabrics
channels:
Expand All @@ -23,5 +23,3 @@ dependencies:
- pip:
- netcdf4
- osmpythontools >= 0.3.5

prefix: C:\ProgramData\Anaconda3\envs\geofabrics
10 changes: 8 additions & 2 deletions src/geofabrics/bathymetry_estimation.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def __init__(
The ordering of the points in the polylines.
"""

self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")

self.channel = channel
self.resolution = resolution
self.sampling_direction = sampling_direction
Expand Down Expand Up @@ -507,6 +509,8 @@ def __init__(
):
"""Setup for interpolating the measured riverbed elevations along
equally spaced cross sections."""
self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")

self.riverbanks = geopandas.read_file(riverbank_file)
self.measured_sections = geopandas.read_file(measured_sections_file)
self.cross_section_spacing = cross_section_spacing
Expand Down Expand Up @@ -554,7 +558,7 @@ def check_valid_inputs(self):
.geometry.interpolate(1, normalized=True)
.distance(self.riverbanks.loc[1].geometry.interpolate(0, normalized=True))
):
logging.Warning(
self.logger.Warning(
"It appears that the `right` and `left` banks are"
"defined in different directions based on the "
"relative distance between the endpoints. Please "
Expand Down Expand Up @@ -822,6 +826,8 @@ def __init__(
The resolution to sample at.
"""

self.logger = logging.getLogger(f"{__name__}.{self.__class__.__name__}")

self.gnd_dem = gnd_dem
self.veg_dem = veg_dem
self.cross_section_spacing = cross_section_spacing
Expand Down Expand Up @@ -1224,7 +1230,7 @@ def variable_thresholded_widths_from_centre_within_radius(
}

for j in range(len(cross_section_elevations["gnd_elevations"])):
logging.info(
self.logger.info(
f"Variable thresholding cross section {j} out of "
f"{len(cross_section_elevations['gnd_elevations'])}"
)
Expand Down
Loading

0 comments on commit 1a3c6a5

Please sign in to comment.