Fldmean does not appear to apply area weights
Added by Nils Slättberg over 5 years ago
Hello,
I seem to have encountered a problem with fldmean. What I want to do is calculate the average over an area, taking into account that the grid box size changes with latitude. Fldmean does not produce any warnings or error messages, but since I can't see the cell-measures attribute in my data I decided to compare the results of fldmean with vs without area weights. That is, I made two files, one produced like: "cdo fldmean infile outfile" and the other: "cdo fldmean,weights=FALSE infile outfile". The values in both files are identical, so I suppose either the area weigths are not applied, OR they are applied in both cases. How can I know if the weights are correctly applied?
My data is ECMWFs reanalysis data (ERA5), converted from grib to netcdf with grib_to_netcdf -o.
Any guidance would be appreciated!
Nils
Replies (9)
RE: Fldmean does not appear to apply area weights - Added by Ralf Mueller over 5 years ago
hi Nils!
Please upload the data or a sample of it so that this can be verified.
thx in advance
ralf
RE: Fldmean does not appear to apply area weights - Added by Nils Slättberg over 5 years ago
Hi Ralf,
here comes the fldmeaned data. Original data too large for upload unfortunately.
Thanks
Nils
fldtest.nc (1.88 KB) fldtest.nc | with area weights | ||
fldtestNOWEIGHTS.nc (1.9 KB) fldtestNOWEIGHTS.nc | no area weights |
RE: Fldmean does not appear to apply area weights - Added by Ralf Mueller over 5 years ago
you can use our public ftp server: ftp.zmaw.de/incoming, user anonymous, passwd: an email-address
RE: Fldmean does not appear to apply area weights - Added by Nils Slättberg over 5 years ago
Hi again,
now the data is on the ftp server in a directory named FldMeanTestData.
adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib is the original file as downloaded from https://cds.climate.copernicus.eu/#!/home.
The fldmeaned files where created from PBLYrMeanTi.nc, which is just yearmonmean of the monthly mean netcdf created from the original file (file history from one of the fldmeaned files below).
history = "Fri Sep 13 15:56:54 2019: cdo fldmean PBLYrMeanTi.nc fldtest.nc\n",
"Fri Sep 13 09:02:00 2019: cdo settunits,years -yearmonmean PBLMonMeanTi.nc PBLYrMeanTi.nc\n",
"2019-09-12 14:32:27 GMT by grib_to_netcdf-1.27.0: /home/tinghai/util/GribAPI/bin/grib_to_netcdf -o PBLMonMeanTi.nc adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib" ;
Nils
RE: Fldmean does not appear to apply area weights - Added by Nils Slättberg over 5 years ago
Hi,
just wanted to check so that the data was correctly uploaded on the server and if you have had a chance to have a look at it?
Nils
RE: Fldmean does not appear to apply area weights - Added by Ralf Mueller over 5 years ago
Hi Nils!
yes, thx for the uploads. I tried this
% cdo -s infov -fldmean,weights=false -yearmonmean adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib 2>>/dev/null cgribexGetTsteptype: Time range indicator 123 unsupported, set to 0! -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name 1 : 1979-06-16 00:00:00 0 1 0 : 611.60 : var159 2 : 1980-06-16 00:00:00 0 1 0 : 615.07 : var159 3 : 1981-06-16 00:00:00 0 1 0 : 617.44 : var159 4 : 1982-06-16 00:00:00 0 1 0 : 619.10 : var159 5 : 1983-06-16 00:00:00 0 1 0 : 620.82 : var159 6 : 1984-06-16 00:00:00 0 1 0 : 614.94 : var159 7 : 1985-06-16 00:00:00 0 1 0 : 616.54 : var159 8 : 1986-05-01 00:00:00 0 1 0 : 618.09 : var159 (pyngl_py3) <ram@melian:~/Downloads> % cdo -s infov -fldmean,weights=true -yearmonmean adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib 2>>/dev/null cgribexGetTsteptype: Time range indicator 123 unsupported, set to 0! -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name 1 : 1979-06-16 00:00:00 0 1 0 : 686.85 : var159 2 : 1980-06-16 00:00:00 0 1 0 : 690.65 : var159 3 : 1981-06-16 00:00:00 0 1 0 : 690.08 : var159 4 : 1982-06-16 00:00:00 0 1 0 : 691.96 : var159 5 : 1983-06-16 00:00:00 0 1 0 : 693.64 : var159 6 : 1984-06-16 00:00:00 0 1 0 : 687.93 : var159 7 : 1985-06-16 00:00:00 0 1 0 : 690.53 : var159 8 : 1986-05-01 00:00:00 0 1 0 : 694.02 : var159Avoiding area weights seem to make a difference. I use cdo-1.9.6 and 1.9.7.1 - both with identical results. Converting the grib to netcdf first with
grib_to_netcdf
or ncl_convert2nc
gives the same result.
Could you post the exact calling sequence and the CDo version you are using? This might help to track down what really happens
cheers
ra;f
RE: Fldmean does not appear to apply area weights - Added by Nils Slättberg over 5 years ago
Hi, thanks!
I use CDO version 1.6.4. The files were created in several steps:
1) grib_to_netcdf -o PBLMonMeanTi.nc adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib
2) cdo settunits,years -yearmonmean PBLMonMeanTi.nc PBLYrMeanTi.nc
3) for fldmean with no weights:
cdo fldmean,weights=FALSE PBLYrMeanTi.nc fldtestNOWEIGHTS.nc
3) for fldmean with weights:
cdo fldmean PBLYrMeanTi.nc fldtest.nc
Using infov the same way you did also gives me the same numbers with and without weights (showing first 10 time steps):
[guest4@hpc PBL]$ cdo -s infov -fldmean,weights=true -yearmonmean adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib 2>>/dev/null
cgribexGetTsteptype : GRIB time range 123 unsupported!
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 1979-06-16 00:00:00 0 1 0 : 686.85 : var159
2 : 1980-06-16 00:00:00 0 1 0 : 690.65 : var159
3 : 1981-06-16 00:00:00 0 1 0 : 690.08 : var159
4 : 1982-06-16 00:00:00 0 1 0 : 691.96 : var159
5 : 1983-06-16 00:00:00 0 1 0 : 693.64 : var159
6 : 1984-06-16 00:00:00 0 1 0 : 687.93 : var159
7 : 1985-06-16 00:00:00 0 1 0 : 690.53 : var159
8 : 1986-06-16 00:00:00 0 1 0 : 691.34 : var159
9 : 1987-06-16 00:00:00 0 1 0 : 693.94 : var159
10 : 1988-06-16 00:00:00 0 1 0 : 695.31 : var159
[guest4@hpc PBL]$ cdo -s infov -fldmean,weights=false -yearmonmean adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib 2>>/dev/null
cgribexGetTsteptype : GRIB time range 123 unsupported!
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 1979-06-16 00:00:00 0 1 0 : 686.85 : var159
2 : 1980-06-16 00:00:00 0 1 0 : 690.65 : var159
3 : 1981-06-16 00:00:00 0 1 0 : 690.08 : var159
4 : 1982-06-16 00:00:00 0 1 0 : 691.96 : var159
5 : 1983-06-16 00:00:00 0 1 0 : 693.64 : var159
6 : 1984-06-16 00:00:00 0 1 0 : 687.93 : var159
7 : 1985-06-16 00:00:00 0 1 0 : 690.53 : var159
8 : 1986-06-16 00:00:00 0 1 0 : 691.34 : var159
9 : 1987-06-16 00:00:00 0 1 0 : 693.94 : var159
10 : 1988-06-16 00:00:00 0 1 0 : 695.31 : var159
Comparing with your numbers, it appears that for me the area weights are applied regardless of whether I set the weights to true or false.
Nils
RE: Fldmean does not appear to apply area weights - Added by Ralf Mueller over 5 years ago
could you update CDO?
RE: Fldmean does not appear to apply area weights - Added by Nils Slättberg over 5 years ago
I tried with CDO version 1.9.5 and now it works! So indeed, the problem seems to be version dependent.
Many thanks for your help!
nils@nils-lap:~/Desktop/MasterProject/data/ERA5/test/data$ cdo -s infov -fldmean,weights=false -yearmonmean adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib 2>>/dev/null
gribapiGetTsteptype: Time stepType avgua unsupported, set to instant!
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 1979-06-16 00:00:00 0 1 0 : 611.60 : blh
2 : 1980-06-16 00:00:00 0 1 0 : 615.07 : blh
3 : 1981-06-16 00:00:00 0 1 0 : 617.44 : blh
4 : 1982-06-16 00:00:00 0 1 0 : 619.10 : blh
5 : 1983-06-16 00:00:00 0 1 0 : 620.82 : blh
6 : 1984-06-16 00:00:00 0 1 0 : 614.94 : blh
7 : 1985-06-16 00:00:00 0 1 0 : 616.54 : blh
8 : 1986-06-16 00:00:00 0 1 0 : 616.37 : blh
9 : 1987-06-16 00:00:00 0 1 0 : 617.28 : blh
10 : 1988-06-16 00:00:00 0 1 0 : 616.75 : blh
nils@nils-lap:~/Desktop/MasterProject/data/ERA5/test/data$ cdo -s infov -fldmean,weights=true -yearmonmean adaptor.mars.internal-1567684060.9333239-9016-5-ec2e84a4-7edc-46c9-afa8-2041b7bd9b58.grib 2>>/dev/null
gribapiGetTsteptype: Time stepType avgua unsupported, set to instant!
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 1979-06-16 00:00:00 0 1 0 : 686.85 : blh
2 : 1980-06-16 00:00:00 0 1 0 : 690.65 : blh
3 : 1981-06-16 00:00:00 0 1 0 : 690.08 : blh
4 : 1982-06-16 00:00:00 0 1 0 : 691.96 : blh
5 : 1983-06-16 00:00:00 0 1 0 : 693.64 : blh
6 : 1984-06-16 00:00:00 0 1 0 : 687.93 : blh
7 : 1985-06-16 00:00:00 0 1 0 : 690.53 : blh
8 : 1986-06-16 00:00:00 0 1 0 : 691.34 : blh
9 : 1987-06-16 00:00:00 0 1 0 : 693.94 : blh
10 : 1988-06-16 00:00:00 0 1 0 : 695.31 : blh