What does 'yhourmean' do?
Added by Julio Chiquetto over 10 years ago
Hello all,
I was wondering how does the 'yhourmean' command works. I read about it on the manual, but wanted to check with someone with more CDO experience.
I have a time series of 16 years of hourly data, from 1996-2011. That makes up 140256 time steps. I used yhourmean, and it gave me an output file with 8784 timesteps, which is the number of hours in a leap year.
So the first value in this time series produced by 'yhourmean' using this data would be the mean of (01/01/1996,1hr)+(01/01/1997,1hr)+(01/01/1998,1hr)...(01/01/2011,1hr)?
I'm just asking because I checked calculating some averages myself and comparing to the ones obtained by this procedure, but the values just don't seem to fit.
I wonder what goes wrong here. Anyone have any experience with 'yhourmean'?
Thank you in advance
Julio
Replies (5)
RE: What does 'yhourmean' do? - Added by Uwe Schulzweida over 10 years ago
Hello Julio,
Yes, the first value should be the mean of the first value from each year! Please send us your data file if this is not the case with your data.
Please read section "mean and average" (https://code.zmaw.de/projects/cdo/embedded/1.6.3/cdo.html#x1-300001.7.1) if the time series contains missing values.
Cheers,
Uwe
RE: What does 'yhourmean' do? - Added by Julio Chiquetto over 10 years ago
Hello Uwe,
Yes, I read that section in tha manual, because I had tried to use 'yhouravg' instead, and it just didn't work well either. I do have a significant amount of missing data, so I have to use 'yhourmean',
I am attaching 3 files:
-NOibira.txt has the original text data of hourly Nitrogen Monoxide concentration, from 1996-2011.
-NOibira.nc contains the same information in netcdf format.
-medhora1.nc is the output file after applying the 'yhourmean' command on NOibira.nc
Thank you for taking your time to reply!
Julio
NOibira.txt (8.56 MB) NOibira.txt | |||
NOibira.nc (1.61 MB) NOibira.nc | |||
medhora1.nc (104 KB) medhora1.nc |
RE: What does 'yhourmean' do? - Added by Andreas Dobler over 10 years ago
Hi Julio,
I stumbled over this issue and had a quick look into it.
cdo outputts medhora1.nc
gives me the following
1996-01-01 01:00:00 0.326804310083
1996-01-01 02:00:00 0.0691613703966
1996-01-01 03:00:00 4.22528791428
However,
cdo outputts -yhourmean NOibira.nc
gives me the following
2012-01-01 00:00:00 0.326804303525
2011-01-01 01:00:00 0.0691613701638
2011-01-01 02:00:00 4.22528769721
Did you check, whether the manually calculated averages are shifted by one time step?
If so,
settaxis,1996-01-01,00:00:00,1h
instead of
settaxis,1996-01-01,01:00:00,1h
could solve the issue.
However, I don't know why cdo yhourmean sorts 2012-01-01 00:00:00 before 2011-01-01 01:00:00
RE: What does 'yhourmean' do? - Added by Uwe Schulzweida over 10 years ago
Yes, the result of yhourmean is correct! Only the first timestep makes the interpretation a little bit confusing. The timesteps are sorted by hour and day of year. The year of the timestep is the year of last contributing timestep.
The last hour of day in the original txt file is 24h. In the netCDF file these timesteps are shifted to the next day 0h. Therefor the first timestep of the result is the timestep at 0h.
So,
settaxis,1996-01-01,00:00:00,1hwill give the correct result.
RE: What does 'yhourmean' do? - Added by Julio Chiquetto over 10 years ago
Hi Andreas and Uwe,
Yes, I was wondering if this rather strange way of recording the hour could have an impact on the time series. After all, 24hr of 01/01/1996 is effectively 00hr of 02/01/1996.
I will change the time axis and check! Hopefully it will work now.
Thank you very much for taking your time :-)
Julio