-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix stats for climatology maps #977
Conversation
The area weights (and not just the fields themselves) need to be masked to exclude land.
@golaz, I really though I had the stats fixed after #860 and #861 but clearly I messed up big time! My only defense, and it's a weak one, is that it seems pretty odd that |
TestingI ran the I also computed the mean outside of MPAS-Analysis using both the MPAS data before remapping: #!/usr/bin/env python
import xarray as xr
mesh_filename = '/lcrc/group/e3sm/public_html/inputdata/share/meshes/mpas/ocean/IcoswISC30E3r5.20231120.nc'
sst_filename = '/lcrc/group/e3sm2/ac.wlin/E3SMv3_dev/20231122.v3b02-Icos30.piControl.chrysalis/post/analysis/mpas_analysis/ts_0001-0300_climo_0251-0300/clim/mpas/avg/masked/sst_IcoswISC30E3r5/mpaso_ANN_025101_030012_climo.nc'
ds_mesh = xr.open_dataset(mesh_filename)
ds_sst = xr.open_dataset(sst_filename)
area = ds_mesh.areaCell
mean_sst = ((ds_sst.timeMonthly_avg_activeTracers_temperature * area).sum() /
area.sum())
print(mean_sst.values) The result is: And the remapped data: #!/usr/bin/env python
import xarray as xr
sst_filname = '/lcrc/group/e3sm2/ac.wlin/E3SMv3_dev/20231122.v3b02-Icos30.piControl.chrysalis/post/analysis/mpas_analysis/ts_0001-0300_climo_0251-0300/clim/mpas/avg/remapped/sst_IcoswISC30E3r5_to_0.5x0.5degree/mpaso_ANN_025101_030012_climo.nc'
ds_sst = xr.open_dataset(sst_filname)
area = ds_sst.area
sst = ds_sst.timeMonthly_avg_activeTracers_temperature
mask = sst.notnull()
mean_sst = ((sst * area).sum() / area.where(mask).sum())
print(mean_sst.values)
mean_sst = ((sst * area).sum() / area.sum())
print(mean_sst.values) The results are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Thanks @xylar for the super quick fix!
@xylar , thanks for fixing this so quickly. I agree that the behavior is confusing. For my own scripts, I typically use This bug also explains why SST RMSE metrics were always much smaller from MPAS-Analysis than from E3SM Diags. Something I had noticed a while ago, but did not dig into. |
@golaz, thanks for the advice on @milenaveneziani, I agree with your slack comment, I prefer the |
Thanks @milenaveneziani and @golaz! @proteanplanet, I think this has enough eyes on it already so I'll remove you as a reviewer. You have a busy week ahead of you! |
The area weights (and not just the fields themselves) need to be masked to exclude land.
Before this fix:
Note: mean of 12.36
But this time series of SST:
After the fix: