Project

General

Profile

Wrong time_bnds assigned

Added by Joerg Trentmann over 12 years ago

Dear cdo-team,

I am working with satellite data (HOAPS 3.2) that come in separate files for each monthly mean and include the time_bnds variable to indicate the boundaries used to derive the monthly averages.

Merging these files into one file using mergetime works perfectly, i.e., the time_bnds variable is correctly transfered to the merged file. Also, when calculating the multiyear monthly mean using ymonmean, no time_bnds variable is included in the output file as it should. However, when I want to calculate anomalies using ymonsub from the original data and the output from the ymonmean-command, the time_bnds variable contains in each time step only the value of the first boundaries, i.e., the dimension of the time_bnds variable is ok, but the values are incorrect. Unfortunately some of my analysis software (panoply) seems to use the information obtained in the time_bnds variable.

Is there any way to prevent this problem? One solution would be to delete the time_bnds variable, since it is not required for my further analysis.

Thanks for your support, kind regards,
Jörg


Replies (7)

RE: Wrong time_bnds assigned - Added by Jaison-Thomas Ambadan over 12 years ago

Hi Jörg ,

Can you please upload a sample of your data (must be < 50MB)?

In the meantime, selecting the particular variable (other than "time_bnds" ) before the required statistical operation should normally solve the problem, i.e., say if "precip" is the name of the variable, then

cdo -ymonsub -selvar,precip infile ourfile

Cheers,
J.

RE: Wrong time_bnds assigned - Added by Joerg Trentmann over 12 years ago

Hi,

please find enclosed a time series file to demonstrate the problem with the time_bnds variable.
When I use
"cdo -r -ymonsub Rain_TimeSeries_2007-2008.nc -ymonmean Rain_TimeSeries_2007-2008.nc tmp.nc"
the time_bnds variable in tmp.nc contains 24 times the values from the first time step.

Thanks, cheers,
Jörg

Rain_TimeSeries_2007-2008.nc (5.09 KB) Rain_TimeSeries_2007-2008.nc Precipitation Time Series

RE: Wrong time_bnds assigned - Added by Jaison-Thomas Ambadan over 12 years ago

Hi,

I think the problem is that CDO time (month/year etc) average/mean operation usually take the first time stamp for the output. At the moment I've a couple of "tricky" temporary solution to your problem.

1. convert your input data to GRIB, which will entirely remove the "time_bnds" co-ordinate variable, i.e.,

a) cdo -f grb -copy Rain_TimeSeries_2007-2008.nc rain.grb
b) cdo -f nc -r -ymonsub rain.grb -ymonmean rain.grb tmp.nc

2. use ncdump and ncgen to modifiy your the output:

a) cdo -r -ymonsub Rain_TimeSeries_2007-2008.nc -ymonmean Rain_TimeSeries_2007-2008.nc outfile.nc
b) ncdump outfile.nc > outfile.dat
c) ncdump Rain_TimeSeries_2007-2008.nc > original.dat
d) Now open the outfile.dat and replace the "time_bnds = ..." part of the file from "original.dat", and save it.
e) ncgen -o tmp.nc outfile.dat

that's it! (I know this solution is not very appealing but ...) Hope this helps!

Cheers,
J.

PS: May be Uwe/Ralf can give you more direct solution

RE: Wrong time_bnds assigned - Added by Joerg Trentmann over 12 years ago

Dear Jaison-Thomas,

thanks for the prompt reply and the proposed solutions.

Interestingly the file that is generated from the ymonmean operator does not contain the time_bnds variable anymore. However, when the ymonsub operator is applied (to the orginal data and the result from the ymonmean operator) it appears again in the output file. While the time variable is correctly transfered to the output file (same as the original file), the time_bnds variable does contain only the first values for each time step. Maybe, in a future version of cdo, also the time_bnds variable can be transfered to the output file in the same way as the time variable.

Thanks, kind regards,
Jörg

RE: Wrong time_bnds assigned - Added by Jaison-Thomas Ambadan over 12 years ago

Hi Jörg,

Interestingly the file that is generated from the ymonmean operator does not contain the time_bnds variable anymore.

That is strange; for me, the "ymonmean" operator (on the ncfile, Rain_TimeSeries_2007-2008.nc) actually gives 12 constant time_bounds (the first bounds, 7305, 7335.99998842593; you can actually see this from ncdump); this in fact transferred to the following ymonsub operation.

Cheers,
J.

PS: I'm using CDO version 1.5.5

RE: Wrong time_bnds assigned - Added by Joerg Trentmann over 12 years ago

PS: I'm using CDO version 1.5.5

OK, this might make a difference, I am using version 1.5.0 on Linux and get no time_bnds after applying ymonmean, when using 1.5.5 under Windows I can reproduce the 12 constant time_bounds... Anyway, in both cases, the final outcome of the anomaly file is the same...

Cheers, Joerg

RE: Wrong time_bnds assigned - Added by Uwe Schulzweida over 12 years ago

Hi Jörg,

Thanks for this report!
The variable time bounds will be removed in the next CDO release for the operator ymonmean.
And the time bounds bug in ymonsub will be fixed!
See also #2474 and #2475.

Cheers,
Uwe

    (1-7/7)