for some reason computing the mean in python and netcdfc++ gives two slightly different values

This commit is contained in:
Robin
2024-12-20 12:36:04 +01:00
parent 1c2ab4af76
commit e1d11e84ce
4 changed files with 20 additions and 5 deletions

View File

@@ -15,9 +15,18 @@ 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)
masked_count = np.ma.count_masked(U)
print("Number of masked values in U:", masked_count)
nan_count = np.isnan(U).sum()
print("Number of NaN values in U:", nan_count)
# Close the NetCDF file
ncfile.close()