i have decided that its probably some weird floaing point thing
This commit is contained in:
parent
314082c160
commit
6834e7786f
23
test_read.py
23
test_read.py
|
|
@ -22,25 +22,12 @@ print("Mean of U:", U_mean)
|
||||||
|
|
||||||
print("Sum of U:", U_sum)
|
print("Sum of U:", U_sum)
|
||||||
|
|
||||||
masked_count = np.ma.count_masked(U)
|
sumval = 0
|
||||||
print("Number of masked values in U:", masked_count)
|
row = U[0,0,100]
|
||||||
|
for val in row:
|
||||||
nan_count = np.isnan(U).sum()
|
|
||||||
print("Number of NaN values in U:", nan_count)
|
|
||||||
|
|
||||||
print("Calculating mean manually (takes a bit cause python is slowww)")
|
|
||||||
|
|
||||||
count = 0
|
|
||||||
valsum = 0
|
|
||||||
for val in U.flat:
|
|
||||||
if not np.ma.is_masked(val):
|
if not np.ma.is_masked(val):
|
||||||
# print(val)
|
sumval += val
|
||||||
valsum += val
|
print(f"Why does {np.sum(row)=} not equal {sumval=} ?!")
|
||||||
count += 1
|
|
||||||
|
|
||||||
print(f"{valsum=} {valsum/count=} {count=}")
|
|
||||||
|
|
||||||
print(f"The problem is this: why does {valsum/count=} not equal {U_mean=}")
|
|
||||||
|
|
||||||
# Close the NetCDF file
|
# Close the NetCDF file
|
||||||
ncfile.close()
|
ncfile.close()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue