Skip to content

Commit ac00534

Browse files
committed
Remove unused function in test_litpop
1 parent 44b0675 commit ac00534

File tree

1 file changed

+2
-44
lines changed

1 file changed

+2
-44
lines changed

climada/entity/exposures/test/test_litpop.py

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -114,48 +114,6 @@ def data_arrays_resampling_demo():
114114
]
115115
return data_arrays, meta_list
116116

117-
def create_target_grid(meta, res_arcsec=None):
118-
"""Create a properly cropped target grid with the right resolution.
119-
120-
Parameters
121-
----------
122-
meta : dict
123-
Metadata dictionary from an original raster grid.
124-
res_arcsec : int, optional
125-
Desired resolution in arcseconds. If None, uses the original resolution.
126-
127-
Returns
128-
-------
129-
target_grid : dict
130-
Dictionary containing the correctly aligned target grid metadata.
131-
"""
132-
import copy
133-
134-
# Make a copy of the original metadata
135-
target_grid = copy.deepcopy(meta)
136-
137-
if res_arcsec is not None:
138-
res_deg = res_arcsec / 3600 # Convert arcseconds to degrees
139-
140-
# Ensure it aligns with the original grid
141-
aligned_lon_min = -180 + (round((meta["transform"][2] - (-180)) / res_deg) * res_deg)
142-
aligned_lat_max = 90 - (round((90 - meta["transform"][5]) / res_deg) * res_deg)
143-
144-
# Define new affine transform
145-
target_grid["transform"] = Affine(
146-
res_deg, 0, aligned_lon_min,
147-
0, -res_deg, aligned_lat_max
148-
)
149-
150-
# Compute width and height
151-
width = int(round(meta["width"] * (meta["transform"].a / res_deg)))
152-
height = int(round(meta["height"] * (abs(meta["transform"].e) / res_deg)))
153-
154-
target_grid["width"] = width
155-
target_grid["height"] = height
156-
157-
return target_grid
158-
159117
class TestLitPop(unittest.TestCase):
160118
"""Test LitPop Class methods and functions"""
161119

@@ -204,7 +162,7 @@ def test_target_grid_alignment(self):
204162
meta_list[0]["width"] = 3
205163
meta_list[0]["height"] = 3
206164

207-
target_res = 2.0 #
165+
target_res = 2.0
208166
target_transform = Affine(target_res, 0, -10.0, 0, -target_res, 40.0)
209167

210168
target_grid = {
@@ -234,7 +192,7 @@ def test_target_grid_alignment(self):
234192
def test_reproject_input_data_downsample_conserve_mean(self):
235193
"""test function reproject_input_data downsampling with conservation of sum"""
236194
data_in, meta_list = data_arrays_resampling_demo()
237-
data_out, meta_out = lp.reproject_input_data(
195+
data_out, _ = lp.reproject_input_data(
238196
data_in,
239197
meta_list,
240198
target_grid=meta_list[1],

0 commit comments

Comments
 (0)