Data
HadCRUT 4
Surface Temperature Anomalies (C with respect to 1961-1990)
Choose a region
Getting my regions in a reusable, correctly projected, and regridded was more difficult than I thought it would be.
Publicly available global region based netCDF files are not common
In the end, I used a shape file to create a netCDF with a single time dimension, and integer layer of region ids at each 1 degree
Australia
Just going with continents at this stage and Australia is the country I was born.
Start with a single day.
; read only desired time 1970
x = fin->temperature_anomaly(1440,:,:)
xr = where(region.eq.2,x,x@_FillValue)
print(avg(xr))
; read only desired time 1970
x = fin->temperature_anomaly(1440,:,:)
xr = where(region.eq.2,x,x@_FillValue)
print(avg(xr))
Then time series for a single year. Oct 2012 to Sept 2013
; Time Series average for Australia 2013
x1=fin->temperature_anomaly(1953:1964,:,:)
rconform = conform(x1, region, (/1,2/))
xr1 =mask(x1, rconform, 2)
xa1 = dim_avg_n(xr1,(/1 , 2/))
t1 = ispan(0,12,1)
wks = gsn_open_wks ("x11","xy") ; open workstation
res = True ; plot mods desired
res@tiMainString = "Average Australian Temperature Anomaly 2013" ;
Result similar to BOM
; Time Series average for Australia 2013
x1=fin->temperature_anomaly(1953:1964,:,:)
rconform = conform(x1, region, (/1,2/))
xr1 =mask(x1, rconform, 2)
xa1 = dim_avg_n(xr1,(/1 , 2/))
t1 = ispan(0,12,1)
wks = gsn_open_wks ("x11","xy") ; open workstation
res = True ; plot mods desired
res@tiMainString = "Average Australian Temperature Anomaly 2013" ;
Result similar to BOM
Then annual time series for a decade or so
yStart = 1990
yEnd = 2013
tStart = (yStart - T_OFFSET ) * 12;
tEnd = (yEnd - T_OFFSET) * 12 + 11
x2=fin->temperature_anomaly(tStart:tEnd,:,:)
rconform2 = conform(x2, region, (/1,2/))
xr2 =mask(x2, rconform2, 2)
copy_VarCoords(x2, xr2) ; need dim metadata retained for clim functions
xa2 = dim_avg_n(xr2,(/1 , 2/))
xannual = month_to_annual(xa2, 1) ;Annual Average Temperautre
printVarSummary(xannual)
wks = gsn_open_wks ("ps","xy") ; open workstation
res = True ; plot mods desired
res@tiMainString = "Annual Mean Australian Temperature 1990-2013" ;
res@tiYAxisString = "Anomalies" ; y-axis label
res@gsnYRefLine = 0. ; reference line
res@gsnXYBarChart = True ; create bar chart
res@gsnAboveYRefLineColor = "red" ; above ref line fill red
res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue
res@tiXAxisString = "Year"
plot = gsn_csm_xy (wks,ispan(yStart,yEnd,1),xannual,res) ; create plot
yStart = 1990
yEnd = 2013
tStart = (yStart - T_OFFSET ) * 12;
tEnd = (yEnd - T_OFFSET) * 12 + 11
x2=fin->temperature_anomaly(tStart:tEnd,:,:)
rconform2 = conform(x2, region, (/1,2/))
xr2 =mask(x2, rconform2, 2)
copy_VarCoords(x2, xr2) ; need dim metadata retained for clim functions
xa2 = dim_avg_n(xr2,(/1 , 2/))
xannual = month_to_annual(xa2, 1) ;Annual Average Temperautre
printVarSummary(xannual)
wks = gsn_open_wks ("ps","xy") ; open workstation
res = True ; plot mods desired
res@tiMainString = "Annual Mean Australian Temperature 1990-2013" ;
res@tiYAxisString = "Anomalies" ; y-axis label
res@gsnYRefLine = 0. ; reference line
res@gsnXYBarChart = True ; create bar chart
res@gsnAboveYRefLineColor = "red" ; above ref line fill red
res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue
res@tiXAxisString = "Year"
plot = gsn_csm_xy (wks,ispan(yStart,yEnd,1),xannual,res) ; create plot
Then summer time series for a decade
; Summer Time Average Temperature anomaly for 2000's
yStart = 2000
yEnd = 2013
tStart = (yStart - T_OFFSET ) * 12 ;
tEnd = (yEnd - T_OFFSET) * 12 + 11
x3=fin->temperature_anomaly(tStart:tEnd,:,:)
rconform3 = conform(x3, region, (/1,2/)) ;Create Mask grid with time dim of data
xr3 =mask(x3, rconform3, 2) ; mask out data not in region 2 , Australia
copy_VarCoords(x3, xr3) ; need dim metadata retained for clim functions
xseasonal = month_to_seasonN(xr3, (/ "DJF"/)) ; Seasonal Average Temperautre
printVarSummary(xseasonal)
xa3 = dim_avg_n(xseasonal,(/2 , 3/)) ; Average across long and lat dimension
; average across region as all other values masked
copy_VarCoords_2(xseasonal,xa3)
printVarSummary(xa3)
print(xa3)
wks = gsn_open_wks ("x11","xy") ; open workstation
res = True ; plot mods desired
res@tiMainString = "Summer Mean Australian Temperature 1990-2013" ;
res@tiYAxisString = "Anomalies" ; y-axis label
res@gsnYRefLine = 0. ; reference line
res@gsnXYBarChart = True ; create bar chart
res@gsnAboveYRefLineColor = "red" ; above ref line fill red
res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue
res@tiXAxisString = "Year"
plot = gsn_csm_xy (wks,ispan(yStart,yEnd,1),xa3(0,:),res) ; create plot
Happy with this time to move on
; Summer Time Average Temperature anomaly for 2000's
yStart = 2000
yEnd = 2013
tStart = (yStart - T_OFFSET ) * 12 ;
tEnd = (yEnd - T_OFFSET) * 12 + 11
x3=fin->temperature_anomaly(tStart:tEnd,:,:)
rconform3 = conform(x3, region, (/1,2/)) ;Create Mask grid with time dim of data
xr3 =mask(x3, rconform3, 2) ; mask out data not in region 2 , Australia
copy_VarCoords(x3, xr3) ; need dim metadata retained for clim functions
xseasonal = month_to_seasonN(xr3, (/ "DJF"/)) ; Seasonal Average Temperautre
printVarSummary(xseasonal)
xa3 = dim_avg_n(xseasonal,(/2 , 3/)) ; Average across long and lat dimension
; average across region as all other values masked
copy_VarCoords_2(xseasonal,xa3)
printVarSummary(xa3)
print(xa3)
wks = gsn_open_wks ("x11","xy") ; open workstation
res = True ; plot mods desired
res@tiMainString = "Summer Mean Australian Temperature 1990-2013" ;
res@tiYAxisString = "Anomalies" ; y-axis label
res@gsnYRefLine = 0. ; reference line
res@gsnXYBarChart = True ; create bar chart
res@gsnAboveYRefLineColor = "red" ; above ref line fill red
res@gsnBelowYRefLineColor = "blue" ; below ref line fill blue
res@tiXAxisString = "Year"
plot = gsn_csm_xy (wks,ispan(yStart,yEnd,1),xa3(0,:),res) ; create plot
Happy with this time to move on
No comments:
Post a Comment