ATLAS icon indicating copy to clipboard operation
ATLAS copied to clipboard

Aggregated values

Open znicholls opened this issue 3 years ago • 3 comments

Hi there,

Thanks for all your efforts with the ATLAS. I have a question about how you arrive at the values in your aggregated dataset. I have attempted to reproduce your values from CMIP6 data and don't arrive at the same numbers, it would be great to know if you have any idea why. The script I use is the below, all it does is read the data in (source files taken from the ESGF), then take an area-weighted mean.

import iris
import numpy as np

SHOW_VALS = 5
K_TO_C = 273.15

cmip5_file = "tas_Amon_ACCESS1-0_rcp45_r1i1p1_200601-201012.nc"
print(f"CMIP5 example: {cmip5_file}")

tas = iris.load_cube(cmip5_file)
tas_raw_mean = tas.collapsed(["longitude", "latitude"], iris.analysis.MEAN)
print("raw mean (K): {}".format(tas_raw_mean.data[:SHOW_VALS]))
print("raw mean (degC): {}".format(tas_raw_mean.data[:SHOW_VALS] - K_TO_C))

tas_area_weighted_mean = tas.collapsed(
    ["longitude", "latitude"],
    iris.analysis.MEAN,
    weights=iris.analysis.cartography.area_weights(tas)
)
print("iris areas, area-weighted mean (K): {}".format(tas_area_weighted_mean.data[:SHOW_VALS]))
print("iris areas, area-weighted mean (degC): {}".format(tas_area_weighted_mean.data[:SHOW_VALS] - K_TO_C))

area_weights = iris.load_cube("areacella_fx_ACCESS1-0_rcp45_r0i0p0.nc")
tas_area_weighted_mean = tas.collapsed(
    ["longitude", "latitude"],
    iris.analysis.MEAN,
    weights=np.broadcast_to(area_weights.data, tas.data.shape)
)
print("ACCESS areas, area-weighted mean (K): {}".format(tas_area_weighted_mean.data[:SHOW_VALS]))
print("ACCESS areas, area-weighted mean (degC): {}".format(tas_area_weighted_mean.data[:SHOW_VALS] - K_TO_C))


cmip6_file = "tas_Amon_MIROC-ES2L_ssp126_r1i1p1f2_gn_201501-210012.nc"
print(f"CMIP6 example: {cmip6_file}")
tas = iris.load_cube(cmip6_file)
tas_raw_mean = tas.collapsed(["longitude", "latitude"], iris.analysis.MEAN)
print("raw mean (K): {}".format(tas_raw_mean.data[:SHOW_VALS]))
print("raw mean (degC): {}".format(tas_raw_mean.data[:SHOW_VALS] - K_TO_C))

tas_area_weighted_mean = tas.collapsed(
    ["longitude", "latitude"],
    iris.analysis.MEAN,
    weights=iris.analysis.cartography.area_weights(tas)
)
print("iris areas, area-weighted mean (K): {}".format(tas_area_weighted_mean.data[:SHOW_VALS]))
print("iris areas, area-weighted mean (degC): {}".format(tas_area_weighted_mean.data[:SHOW_VALS] - K_TO_C))

area_weights = iris.load_cube("areacella_fx_MIROC-ES2L_ssp126_r1i1p1f2_gn.nc")
tas_area_weighted_mean = tas.collapsed(
    ["longitude", "latitude"],
    iris.analysis.MEAN,
    weights=np.broadcast_to(area_weights.data, tas.data.shape)
)
print("MIROC-ES2L areas, area-weighted mean (K): {}".format(tas_area_weighted_mean.data[:SHOW_VALS]))
print("MIROC-ES2L areas, area-weighted mean (degC): {}".format(tas_area_weighted_mean.data[:SHOW_VALS] - K_TO_C))

If I run this script, I get

$ python compare_atlas_simple_check.py 
CMIP5 example: tas_Amon_ACCESS1-0_rcp45_r1i1p1_200601-201012.nc

raw mean (K): [276.4684753417969 275.66357421875 275.80029296875 276.8258361816406
 278.55279541015625]
raw mean (degC): [3.3184814453125 2.513580322265625 2.650299072265625 3.67584228515625
 5.402801513671875]

iris areas, area-weighted mean (K): [285.52167953768986 285.6187406669899 286.48461306568055 287.3709760209917
 288.40164308778714]
iris areas, area-weighted mean (degC): [12.371679537689886 12.468740666989902 13.334613065680571
 14.220976020991714 15.251643087787158]

ACCESS areas, area-weighted mean (K): [285.52166748046875 285.61871337890625 286.4845886230469 287.3709411621094
 288.4016418457031]
ACCESS areas, area-weighted mean (degC): [12.371673583984375 12.468719482421875 13.3345947265625 14.220947265625
 15.25164794921875]

CMIP6 example: tas_Amon_MIROC-ES2L_ssp126_r1i1p1f2_gn_201501-210012.nc

raw mean (K): [280.04962158203125 279.3348388671875 279.257568359375 280.63916015625
 282.047607421875]
raw mean (degC): [6.899627685546875 6.184844970703125 6.107574462890625 7.489166259765625
 8.897613525390625]

iris areas, area-weighted mean (K): [287.44583487855414 287.6124896981895 288.3990031516224 289.4096341190363
 290.3122343145591]
iris areas, area-weighted mean (degC): [14.29583487855416 14.462489698189529 15.249003151622446 16.25963411903632
 17.1622343145591]

MIROC-ES2L areas, area-weighted mean (K): [287.44586181640625 287.61248779296875 288.3990173339844 289.4096374511719
 290.312255859375]
MIROC-ES2L areas, area-weighted mean (degC): [14.295867919921875 14.462493896484375 15.2490234375 16.2596435546875
 17.162261962890625]

This output doesn't agree with your datasets and I am puzzled about why. More specifically:

  • 2006-01 value for rcp45 ACCESS1 r1i1p1, I get: 12.372, you report: 13.185
  • 2006-02 value for rcp45 ACCESS1 r1i1p1, I get: 12.469, you report: 13.305

(the CMIP6 differences are much smaller so could be explained by re-gridding differences?)

  • 2015-01 value for ssp126 MIROC-ES2L r1i1p1f2, I get: 14.296, you report: 14.276
  • 2015-02 value for ssp126 MIROC-ES2L r1i1p1f2, I get: 14.462, you report: 14.439

znicholls avatar Oct 07 '20 11:10 znicholls

@miturbide are you the best person to ask about this?

znicholls avatar Oct 07 '20 11:10 znicholls

Hi znicholls, As you have pointed out, I would say that the differences are explained by re-gridding differences. In any case, thanks for reporting and for the double check, we will perform further checks and let you know.

miturbide avatar Oct 07 '20 12:10 miturbide

Awesome thanks!

znicholls avatar Oct 07 '20 12:10 znicholls