Open atteggiani opened 1 month ago
Indeed, the single method/__init__
only class is a sign of unclear design. Also, __init__
is doing multiple things: file I/O, lat/long calcs, control flow, array ops & setting member vars. It's a sign to break down the problem into smaller pieces.
Shapely may suit for providing generic geometry data structures too: https://shapely.readthedocs.io/en/stable/manual.html
The
bounding_box
class:https://github.com/ACCESS-NRI/replace_landsurface/blob/2dcc1d77ca4fb7d4dcb6311db575bd2b21d700b4/src/replace_landsurface_with_ERA5land_IC.py#L37-L115
ultimately, is used to get the extents of the input file in terms of min and max longitudes and latitudes (
lonmin
,lonmax
,latmin
andlatmax
).The class does not currently hold any methods (apart from the
__init__
) or attributes apart from the lat/lon extents it needs to produce.I suggest turning it into a function to: