From 386bc385c274e002f65dcad4cc0ce459cafd476b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yasunori=20Morishima=EF=BC=88=E7=9B=9B=E5=B3=B6=E5=BA=B7?= =?UTF-8?q?=E5=BE=B3=EF=BC=89?= Date: Thu, 19 Mar 2026 10:26:29 +0000 Subject: [PATCH 1/2] fix: replace numpy 2.0 removed APIs (np.NaN, np.float) - Replace np.NaN with np.nan (8 occurrences across 4 files) - Replace np.float with np.float64 (2 occurrences across 2 files) - Update numpy version constraint: numpy<2.0.0 -> numpy>=1.24.0 in both setup.cfg and requirements.txt Resolves #154 --- =2.0.0 | 9 +++++++++ kamodo_ccmc/flythrough/SF_output.py | 2 +- kamodo_ccmc/readers/adelphi_tocdf.py | 4 ++-- kamodo_ccmc/readers/hapi.py | 2 +- kamodo_ccmc/readers/superdarn_tocdf.py | 6 +++--- kamodo_ccmc/readers/swmf_gm_octree.py | 2 +- kamodo_ccmc/readers/verb3d_4D.py | 4 ++-- requirements.txt | 2 +- setup.cfg | 2 +- 9 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 =2.0.0 diff --git a/=2.0.0 b/=2.0.0 new file mode 100644 index 00000000..789cc78c --- /dev/null +++ b/=2.0.0 @@ -0,0 +1,9 @@ +Collecting numpy + Downloading numpy-2.4.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB) +Downloading numpy-2.4.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB) + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.6/16.6 MB 46.0 MB/s 0:00:00 +Installing collected packages: numpy +Successfully installed numpy-2.4.3 + +[notice] A new release of pip is available: 25.3 -> 26.0.1 +[notice] To update, run: python3 -m pip install --upgrade pip diff --git a/kamodo_ccmc/flythrough/SF_output.py b/kamodo_ccmc/flythrough/SF_output.py index 5a386b1c..e8ccadb9 100644 --- a/kamodo_ccmc/flythrough/SF_output.py +++ b/kamodo_ccmc/flythrough/SF_output.py @@ -43,7 +43,7 @@ def Functionalize_TimeSeries(utc_time, variable_name, variable_units, # Define an interpolator for the given time series array. interp = interp1d(utc_time, variable_data, bounds_error=False, - fill_value=np.NaN) + fill_value=np.nan) # Functionalize the time series array @kamodofy(units=variable_units, data=variable_data) # units diff --git a/kamodo_ccmc/readers/adelphi_tocdf.py b/kamodo_ccmc/readers/adelphi_tocdf.py index 1bead271..725a7ae3 100644 --- a/kamodo_ccmc/readers/adelphi_tocdf.py +++ b/kamodo_ccmc/readers/adelphi_tocdf.py @@ -130,7 +130,7 @@ def combine_hemispheres(north_file, south_file): data[key][:, 1:, :len_lat] = np.flip(data_S[key], axis=2) # S data data[key][:, 1:, len_lat] = data[key][:, 1:, len_lat-1] # value buffer data[key][:, 1:, len_lat+1:len_lat+3] = \ - np.tile(np.NaN, (new_shape[0], new_shape[1]-1, 2)) # NaN buffer + np.tile(np.nan, (new_shape[0], new_shape[1]-1, 2)) # NaN buffer data[key][:, 1:, len_lat+3] = data[key][:, 1:, len_lat+4] # value buff data[key][:, 1:, len_lat+4:] = data_N[key] # N hemisphere data @@ -156,7 +156,7 @@ def combine_hemispheres(north_file, south_file): NP_idx -= 1 zero_check = np.count_nonzero(data[key][:, :, NP_idx]) # replace 'extra' latitude rows from data with NaNs - data[key][:, :, slice_idx] = np.tile(np.NaN, ( + data[key][:, :, slice_idx] = np.tile(np.nan, ( new_shape[0], new_shape[1], len(slice_idx))) # data wrangling complete, return data dictionary diff --git a/kamodo_ccmc/readers/hapi.py b/kamodo_ccmc/readers/hapi.py index e051a49d..7a18ab5d 100644 --- a/kamodo_ccmc/readers/hapi.py +++ b/kamodo_ccmc/readers/hapi.py @@ -122,7 +122,7 @@ def __init__(self, server, dataset, parameters = None, start = None, stop = None # Fix wonky geotail data aunit="nT" afill = 0.1*float(afill) - adata = 0.1*adata.astype(np.float) + adata = 0.1*adata.astype(np.float64) if aunit == "n/cc": # The unit n/cc should be 1/cc to register properly in Kamodo aunit = "1/cc" diff --git a/kamodo_ccmc/readers/superdarn_tocdf.py b/kamodo_ccmc/readers/superdarn_tocdf.py index 8ebddad1..828d7fc4 100644 --- a/kamodo_ccmc/readers/superdarn_tocdf.py +++ b/kamodo_ccmc/readers/superdarn_tocdf.py @@ -175,12 +175,12 @@ def df_data(df_file, verbose=False): tmp[:, 2:-1] = variables[var] # copy data into grid tmp[:, -1] = np.mean(tmp[:, -2], axis=0) tmp[:, 1] = variables[var][:, 0] # buffer row - tmp[:, 0] = np.NaN # add NaNs on equator side + tmp[:, 0] = np.nan # add NaNs on equator side else: # south pole at beginning of array tmp[:, 1:-2] = variables[var] # copy data into grid tmp[:, 0] = np.mean(tmp[:, 1], axis=0) tmp[:, -2] = variables[var][:, 0] # buffer row - tmp[:, -1] = np.NaN # add NaNs on equator side + tmp[:, -1] = np.nan # add NaNs on equator side variables[var] = tmp # latitude wrapping in coordinate grid @@ -357,7 +357,7 @@ def ea_data(ea_file, verbose=False): # addind NaN on equator-side assuming the data never reaches it. variables[var][new_vals[1]] = variables[var][lat_equator] # buffer row - variables[var][new_vals[0]] = np.NaN * \ + variables[var][new_vals[0]] = np.nan * \ np.ones(shape=variables[var][lat_equator].shape) # hemisphere spcific data wrangling complete. return data. diff --git a/kamodo_ccmc/readers/swmf_gm_octree.py b/kamodo_ccmc/readers/swmf_gm_octree.py index 303a854f..4e14f810 100644 --- a/kamodo_ccmc/readers/swmf_gm_octree.py +++ b/kamodo_ccmc/readers/swmf_gm_octree.py @@ -276,7 +276,7 @@ def interpolator(xvec): ypos=OCTREE_BLOCK_GRID_FFI.new("float[]",list(xvec[:,1])) zpos=OCTREE_BLOCK_GRID_FFI.new("float[]",list(xvec[:,2])) npos=len(list(xvec[:,0])) - return_data=list(np.zeros(npos,dtype=np.float)) + return_data=list(np.zeros(npos,dtype=np.float64)) return_data_ffi=OCTREE_BLOCK_GRID_FFI.new("float[]",return_data) # print(xpos,ypos,zpos,npos) # print(var_data,return_data_ffi) diff --git a/kamodo_ccmc/readers/verb3d_4D.py b/kamodo_ccmc/readers/verb3d_4D.py index 329c2c0e..dfb75278 100644 --- a/kamodo_ccmc/readers/verb3d_4D.py +++ b/kamodo_ccmc/readers/verb3d_4D.py @@ -647,7 +647,7 @@ def _intrep_xvec_data_prepare(self, xvec): # Check for NaN values nan_check = np.isnan(L) | np.isnan(Y) | np.isnan(Z) if np.all(nan_check): - return L, Y, Z, np.full(nobs, np.NaN), None, None + return L, Y, Z, np.full(nobs, np.nan), None, None # Handle NaN points in the input data L[nan_check] = np.nan @@ -663,7 +663,7 @@ def _intrep_xvec_data_prepare(self, xvec): limax = min(limax + 1, num_L_grid - 1) if (Lmax > max_L_grid and Lmin > max_L_grid) or (Lmax < min_L_grid and Lmin < min_L_grid): - return L, Y, Z, np.full(nobs, np.NaN), limin, limax + return L, Y, Z, np.full(nobs, np.nan), limin, limax return L, Y, Z, None, limin, limax diff --git a/requirements.txt b/requirements.txt index 0eb0a94a..22d33c6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ python-markdown-math markdown_include kamodo cffi -numpy<2.0.0 +numpy>=1.24.0 pandas<2.0.0 netCDF4<1.7.0 nbformat diff --git a/setup.cfg b/setup.cfg index b0e01bba..ca6ed23f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -33,7 +33,7 @@ include_package_data = True install_requires = kamodo setuptools<65 - numpy<2.0.0 + numpy>=1.24.0 pandas netCDF4<1.7.0 nbformat From e7518107e2e0a9c2d53452b6df4f13aa3cc73cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yasunori=20Morishima=EF=BC=88=E7=9B=9B=E5=B3=B6=E5=BA=B7?= =?UTF-8?q?=E5=BE=B3=EF=BC=89?= Date: Thu, 19 Mar 2026 10:26:42 +0000 Subject: [PATCH 2/2] chore: remove accidentally created file --- =2.0.0 | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 =2.0.0 diff --git a/=2.0.0 b/=2.0.0 deleted file mode 100644 index 789cc78c..00000000 --- a/=2.0.0 +++ /dev/null @@ -1,9 +0,0 @@ -Collecting numpy - Downloading numpy-2.4.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB) -Downloading numpy-2.4.3-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB) - ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.6/16.6 MB 46.0 MB/s 0:00:00 -Installing collected packages: numpy -Successfully installed numpy-2.4.3 - -[notice] A new release of pip is available: 25.3 -> 26.0.1 -[notice] To update, run: python3 -m pip install --upgrade pip