From 47e23dc12e1366bc636c35b995984ff7b72486db Mon Sep 17 00:00:00 2001 From: Martin Opat Date: Mon, 30 Dec 2024 12:12:58 +0100 Subject: [PATCH] Updated TODOs --- src/objs/sphere.h | 2 +- test_read.py | 51 ----------------------------------------------- test_read2.py | 18 ----------------- test_read3.py | 30 ---------------------------- 4 files changed, 1 insertion(+), 100 deletions(-) delete mode 100644 test_read.py delete mode 100644 test_read2.py delete mode 100644 test_read3.py diff --git a/src/objs/sphere.h b/src/objs/sphere.h index f66e0af..dbac251 100644 --- a/src/objs/sphere.h +++ b/src/objs/sphere.h @@ -80,7 +80,7 @@ __host__ void generateVolume(float* volumeData, int volW, int volH, int volD) { } } -// Samples the voxel nearest to the given coordinates. TODO: Can be re-used in other places +// Samples the voxel nearest to the given coordinates. TODO: Can be re-used in other places so move __device__ float sampleVolumeNearest(float* volumeData, const int volW, const int volH, const int volD, int vx, int vy, int vz) { if (vx < 0) vx = 0; if (vy < 0) vy = 0; diff --git a/test_read.py b/test_read.py deleted file mode 100644 index e37c4a3..0000000 --- a/test_read.py +++ /dev/null @@ -1,51 +0,0 @@ -import numpy as np -from netCDF4 import Dataset - -# Load the NetCDF file -file_path = 'data/MERRA2_400.inst6_3d_ana_Np.20120101.nc4' -ncfile = Dataset(file_path, 'r') - -# Check the available variables in the file -print(ncfile.variables.keys()) - -U = ncfile.variables['T'][:] - -# Check the shape of the variable -print("Shape of U:", U.shape) - -# Compute the mean of the variable across all axes (for all elements in U) -U_mean = np.mean(U) -U_sum = np.sum(U) - -# Print the mean -print("Mean of U:", U_mean) - -print("Sum of U:", U_sum) - -sumval = 0 -row = U[2,20,100] - -print("Shape of row", row.shape) -print("Row data for first 20 entries", row[0:5]) - -row = row[0:5] -print(f"{type(row)} {row.dtype}") - -n = 0 -for val in row: - #if not np.ma.is_masked(val): - n+=1 - sumval += np.float64(val) -Mean1 = np.mean(row) -Mean2 = sumval/n - -print(type(Mean1)) -print(type(Mean2)) -print(Mean1) -print(Mean2) - -print(f"Why does {np.mean(row):.10f} not equal {sumval/n:.10f} ?!") - - -# Close the NetCDF file -ncfile.close() \ No newline at end of file diff --git a/test_read2.py b/test_read2.py deleted file mode 100644 index b137d14..0000000 --- a/test_read2.py +++ /dev/null @@ -1,18 +0,0 @@ -import numpy as np -from netCDF4 import Dataset - -# Load the NetCDF file -file_path = 'data/MERRA2_400.inst6_3d_ana_Np.20120101.nc4' -ncfile = Dataset(file_path, 'r') - -# Check the available variables in the file -print(ncfile.variables.keys()) - -Temp = ncfile.variables['T'][:] - -print(f"{Temp[1, 20, 100, 100]=}") -print(f"{Temp.flat[12949732]=}") - - -# Close the NetCDF file -ncfile.close() \ No newline at end of file diff --git a/test_read3.py b/test_read3.py deleted file mode 100644 index 335b7e9..0000000 --- a/test_read3.py +++ /dev/null @@ -1,30 +0,0 @@ -import numpy as np -from netCDF4 import Dataset - -# file_path = 'data/MERRA2_400.inst6_3d_ana_Np.20120101.nc4' -# ncfile = Dataset(file_path, 'r') - -file_paths = [ - 'data/atmosphere_MERRA-wind-speed[179253532]/MERRA2_400.inst6_3d_ana_Np.20120101.nc4', - 'data/atmosphere_MERRA-wind-speed[179253532]/MERRA2_400.inst6_3d_ana_Np.20120102.nc4', - 'data/atmosphere_MERRA-wind-speed[179253532]/MERRA2_400.inst6_3d_ana_Np.20120103.nc4' -] - -ncfiles = [Dataset(file_path) for file_path in file_paths] - - -# print(f"{Temp[0, 20, 100, 100]=}") - -for i in range(10): - Temp = ncfiles[i//4].variables['T'][:] - x = Temp[i%4, 20, 100, 100] - - Temp2 = ncfiles[(i+1)//4].variables['T'][:] - y = Temp2[(i+1)%4, 20, 100, 100] - print(f"{(x+y)/2=}") - - - -# Close the NetCDF file -for ncfile in ncfiles: - ncfile.close() \ No newline at end of file