Month mismatch when calculating anomalies from monthly climatology
Added by John Staunton Sykes about 5 years ago
Dear CDO community,
I've run into a problem while using cdo to calculate anomalies from a monthly climatology. Hope you can help!
The problem is as follows:
I have 10 years of monthly climate model data that starts in July (experimental data set), and a 12 month monthly climatology (control) which starts in Jan and is calculated from 20 years worth of climate model data using 'cdo ymonmean infile outfile'.
I want to calculate the monthly anomaly over the 10 year experiment data from the control climatology (i.e. July(exp)-july(clim), and Aug(exp)-Aug(clim) etc). To do this, I've been using cdo ymonsub infile1 infile2 outfile, but it seems to just take month 1 from month 1 (i.e. July(exp) - Jan(clim) etc).
Combining the two steps (making the climatology and calculating the anomaly) doesn't seem to help either, cdo ymonsub infile -ymonmean infile outfile.
How can I change this command in order to ensure that the correct month is being used when I calculate the anomaly? I've been looking for a way to shift the months by 6 but haven't got anywhere.
Thank you in advance for any help!
Replies (7)
RE: Month mismatch when calculating anomalies from monthly climatology - Added by Karin Meier-Fleischer about 5 years ago
Hi John,
can you upload your files?
-Karin
RE: Month mismatch when calculating anomalies from monthly climatology - Added by John Staunton Sykes about 5 years ago
Hi Karin,
Thanks for the reply.
Unfortunately not, both the 1 yr climatology and also the 10yr data set are too big to be attached.
I've tried zipping them too but they are still too big.
Some more information about my two files in case it helps:
A)10 yr climate model output data (July to June 10 times)- (time: 120; atmosphere_hybrid_height_coordinate: 85; latitude: 144; longitude: 192)
B)1 yr climatology (Jan to Dec) created from a 20 yr control climate data using 'cdo ymonmean' - (time: 12; atmosphere_hybrid_height_coordinate: 85; latitude: 144; longitude: 192).
I'd like to calculate the multi year monthly anomaly i.e. A (July yr 'n') - B(July) etc.. where n = 1 to 10.
Does this help?
Thanks in advance
RE: Month mismatch when calculating anomalies from monthly climatology - Added by Brendan DeTracey about 5 years ago
What formats are the dates in both files?
RE: Month mismatch when calculating anomalies from monthly climatology - Added by John Staunton Sykes about 5 years ago
Hi Brendan,
The date format is day since 2055.
I've attached the below time coordinate data for both files:
1 yr Climatology:
[DimCoord(array([ 7215., 7245., 7275., 7305., 7335., 7365., 7395., 7425.,
7455., 7485., 7515., 7545.]), standard_name=u'time', units=Unit('days since 2055-1-1', calendar='360_day'), var_name='time')]
10 yr climate model output data:
[DimCoord(array([ 195., 225., 255., 285., 315., 345., 375., 405.,
435., 465., 495., 525., 555., 585., 615., 645.,
675., 705., 735., 765., 795., 825., 855., 885.,
915., 945., 975., 1005., 1035., 1065., 1095., 1125.,
1155., 1185., 1215., 1245., 1275., 1305., 1335., 1365.,
1395., 1425., 1455., 1485., 1515., 1545., 1575., 1605.,
1635., 1665., 1695., 1725., 1755., 1785., 1815., 1845.,
1875., 1905., 1935., 1965., 1995., 2025., 2055., 2085.,
2115., 2145., 2175., 2205., 2235., 2265., 2295., 2325.,
2355., 2385., 2415., 2445., 2475., 2505., 2535., 2565.,
2595., 2625., 2655., 2685., 2715., 2745., 2775., 2805.,
2835., 2865., 2895., 2925., 2955., 2985., 3015., 3045.,
3075., 3105., 3135., 3165., 3195., 3225., 3255., 3285.,
3315., 3345., 3375., 3405., 3435., 3465., 3495., 3525.,
3555., 3585., 3615., 3645., 3675., 3705., 3735., 3765.]), bounds=array( 180., 210.],<br /> [ 210., 240.],<br /> [ 240., 270.],<br /> [ 270., 300.],<br /> [ 300., 330.],<br /> [ 330., 360.],<br /> [ 360., 390.],<br /> [ 390., 420.],<br /> [ 420., 450.],<br /> [ 450., 480.],<br /> [ 480., 510.],<br /> [ 510., 540.],<br /> [ 540., 570.],<br /> [ 570., 600.],<br /> [ 600., 630.],<br /> [ 630., 660.],<br /> [ 660., 690.],<br /> [ 690., 720.],<br /> [ 720., 750.],<br /> [ 750., 780.],<br /> [ 780., 810.],<br /> [ 810., 840.],<br /> [ 840., 870.],<br /> [ 870., 900.],<br /> [ 900., 930.],<br /> [ 930., 960.],<br /> [ 960., 990.],<br /> [ 990., 1020.],<br /> [ 1020., 1050.],<br /> [ 1050., 1080.],<br /> [ 1080., 1110.],<br /> [ 1110., 1140.],<br /> [ 1140., 1170.],<br /> [ 1170., 1200.],<br /> [ 1200., 1230.],<br /> [ 1230., 1260.],<br /> [ 1260., 1290.],<br /> [ 1290., 1320.],<br /> [ 1320., 1350.],<br /> [ 1350., 1380.],<br /> [ 1380., 1410.],<br /> [ 1410., 1440.],<br /> [ 1440., 1470.],<br /> [ 1470., 1500.],<br /> [ 1500., 1530.],<br /> [ 1530., 1560.],<br /> [ 1560., 1590.],<br /> [ 1590., 1620.],<br /> [ 1620., 1650.],<br /> [ 1650., 1680.],<br /> [ 1680., 1710.],<br /> [ 1710., 1740.],<br /> [ 1740., 1770.],<br /> [ 1770., 1800.],<br /> [ 1800., 1830.],<br /> [ 1830., 1860.],<br /> [ 1860., 1890.],<br /> [ 1890., 1920.],<br /> [ 1920., 1950.],<br /> [ 1950., 1980.],<br /> [ 1980., 2010.],<br /> [ 2010., 2040.],<br /> [ 2040., 2070.],<br /> [ 2070., 2100.],<br /> [ 2100., 2130.],<br /> [ 2130., 2160.],<br /> [ 2160., 2190.],<br /> [ 2190., 2220.],<br /> [ 2220., 2250.],<br /> [ 2250., 2280.],<br /> [ 2280., 2310.],<br /> [ 2310., 2340.],<br /> [ 2340., 2370.],<br /> [ 2370., 2400.],<br /> [ 2400., 2430.],<br /> [ 2430., 2460.],<br /> [ 2460., 2490.],<br /> [ 2490., 2520.],<br /> [ 2520., 2550.],<br /> [ 2550., 2580.],<br /> [ 2580., 2610.],<br /> [ 2610., 2640.],<br /> [ 2640., 2670.],<br /> [ 2670., 2700.],<br /> [ 2700., 2730.],<br /> [ 2730., 2760.],<br /> [ 2760., 2790.],<br /> [ 2790., 2820.],<br /> [ 2820., 2850.],<br /> [ 2850., 2880.],<br /> [ 2880., 2910.],<br /> [ 2910., 2940.],<br /> [ 2940., 2970.],<br /> [ 2970., 3000.],<br /> [ 3000., 3030.],<br /> [ 3030., 3060.],<br /> [ 3060., 3090.],<br /> [ 3090., 3120.],<br /> [ 3120., 3150.],<br /> [ 3150., 3180.],<br /> [ 3180., 3210.],<br /> [ 3210., 3240.],<br /> [ 3240., 3270.],<br /> [ 3270., 3300.],<br /> [ 3300., 3330.],<br /> [ 3330., 3360.],<br /> [ 3360., 3390.],<br /> [ 3390., 3420.],<br /> [ 3420., 3450.],<br /> [ 3450., 3480.],<br /> [ 3480., 3510.],<br /> [ 3510., 3540.],<br /> [ 3540., 3570.],<br /> [ 3570., 3600.],<br /> [ 3600., 3630.],<br /> [ 3630., 3660.],<br /> [ 3660., 3690.],<br /> [ 3690., 3720.],<br /> [ 3720., 3750.],<br /> [ 3750., 3780.), standard_name=u'time', units=Unit('days since 2055-1-1', calendar='360_day'), var_name='time')]
Many thanks
RE: Month mismatch when calculating anomalies from monthly climatology - Added by Brendan DeTracey about 5 years ago
Try subsetting both files with:cdo sellevidx,0 -selboxidx,0,0,0,0
So you can upload them. This is assuming that there is data at index location (0,0,0)
, (if not choose another location).
RE: Month mismatch when calculating anomalies from monthly climatology - Added by John Staunton Sykes about 5 years ago
Hi Brendan,
Many thanks for the suggestion. I subsetted both files using cdo sellonlatbox to 1 lat and lon.
Please find the two files attached.
RE: Month mismatch when calculating anomalies from monthly climatology - Added by Karin Meier-Fleischer about 5 years ago
You have to select the correct dates with the operator seldate, first.
cdo -ymonsub -seldate,2056-01-16,2064-12-16 50219_SSP245_ensmean-clim_anomaly_test.nc 50219_bo467_SSP245_monclim_test.nc anomalies.nc
-Karin