Hello Pangeo,
I am really new to python/xarray/dask so please excuse if the solution of my problem is really obvious or my explanation is a little unclear. Every help is highly appreciated!
Goal: I want to calculate the global mean of some ocean variable (density) of the GFDL CM2.6 Model.
In order to do so I mask out the ocean area and then calculate the global mean with three different approaches (2 approaches in xarray, one in ferret) in order to check if I get the same result  spoiler alert: I donâ€™t.
Used Data: NetCDF GFDL CM2.6 Data which is on the Pangeo Platform. I use the grid information as well as the 3D fields (salt, temperature) for the calculation of the density.
Important Gridinformation:
Information of zweighted Density (using zweighted mean in order to account for different grid spacing in the vertical):
Calculating of global mean with xarray:
In my first step I define the ocean area, whereby I use the information saved in the grid. And calculate the total ocean area, which I need later on.

I then calculate the oceanareamean value as a weighted mean, whereby I define the latitude weights and then calculate a weighted mean:

My other idea was to calculate the mean just by making the calculation â€žmyselfâ€ś: multiplying every value with the cellarea and then dividing through the total ocean area:
Sadly, both calculation result in slightly different values.
Calculating global mean with ferret
This results in a smaller number.
Now I am not sure what the â€žcorrectâ€ś way is and where my mistakes are. The differences seem to me too big to just arise from numeric inaccuracies. However, the variables are â€śjustâ€ť saved with float32, so maybe numeric inaccuracies are the cause.
Can someone help me?
Thank you so much and have a great rest of the day