Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 735e129

Browse files
authored
Merge pull request #332 from openclimatefix/numpy2
Update to numpy 2
2 parents f8f765c + fc44aca commit 735e129

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

ocf_datapipes/transform/numpy_batch/add_fourier_space_time.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def compute_fourier_features(
127127
)
128128
fourier_features = np.full(
129129
shape=array.shape + (n_fourier_features,),
130-
fill_value=np.NaN,
130+
fill_value=np.nan,
131131
dtype=array.dtype,
132132
)
133133

ocf_datapipes/transform/numpy_batch/add_topographic_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def _get_surface_height_for_satellite(
7575
"""
7676
num_examples = satellite.shape[0]
7777
surface_height = surface_height.rename("surface_height")
78-
surface_height_for_batch = np.full_like(satellite.values, fill_value=np.NaN)
78+
surface_height_for_batch = np.full_like(satellite.values, fill_value=np.nan)
7979
for example_idx in range(num_examples):
8080
satellite_example = satellite.isel(example=example_idx)
8181
msg = "Satellite imagery must start in the top-left!"

ocf_datapipes/transform/numpy_batch/sun_position.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def _get_azimuth_and_elevation(lon, lat, dt, must_be_finite):
2525
if must_be_finite:
2626
raise ValueError(f"Non-finite (lon, lat) = ({lon}, {lat}")
2727
return (
28-
np.full_like(dt, fill_value=np.NaN).astype(np.float32),
29-
np.full_like(dt, fill_value=np.NaN).astype(np.float32),
28+
np.full_like(dt, fill_value=np.nan).astype(np.float32),
29+
np.full_like(dt, fill_value=np.nan).astype(np.float32),
3030
)
3131

3232
else:
@@ -156,8 +156,8 @@ def __iter__(self):
156156
assert lons.shape == (time_utc.shape[0],)
157157
assert lats.shape == (time_utc.shape[0],)
158158

159-
azimuth = np.full_like(time_utc, fill_value=np.NaN).astype(np.float32)
160-
elevation = np.full_like(time_utc, fill_value=np.NaN).astype(np.float32)
159+
azimuth = np.full_like(time_utc, fill_value=np.nan).astype(np.float32)
160+
elevation = np.full_like(time_utc, fill_value=np.nan).astype(np.float32)
161161

162162
# Loop round each example to get the Sun's elevation and azimuth
163163
for example_idx, (lon, lat, dt) in enumerate(zip(lons, lats, times)):

ocf_datapipes/utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def datetime64_to_float(datetimes: np.ndarray, dtype=np.float64) -> np.ndarray:
2828
"""
2929
nums = datetimes.astype("datetime64[s]").astype(dtype)
3030
mask = np.isfinite(datetimes)
31-
return np.where(mask, nums, np.NaN)
31+
return np.where(mask, nums, np.nan)
3232

3333

3434
def is_sorted(array: np.ndarray) -> bool:

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ scipy
2525
pytorch_lightning
2626
pvlive-api
2727
pydantic
28+
cftime

0 commit comments

Comments
 (0)