function month_to_name(month,opt) begin months1=(/"January","February","March","April","May","June", "July","August","September","October","November","December"/) month_chars=stringtochar(months1) months2=chartostring ( month_chars(:,:2) ) if (opt.eq.0) return(months1(month-1)) print(months1(month-1)) else return(months2(month-1)) end if end procedure time_axis_in_years(res,time,time_int) begin if (res.and.isatt ( res,"tmXBValues" ) ) then delete(res@tmXBValues) end if if (res.and.isatt ( res,"tmXBLabels" ) ) then delete(res@tmXBLabels) end if utc_date = ut_calendar(time(0), 0) yr1=floattoint( utc_date(:,0)) ntim=dimsizes(time) utc_date = ut_calendar(time(ntim-1), 0) yr2=floattoint( utc_date(:,0)) res@tmXBMode="Explicit" res@tmXBValues=time(::time_int*12) res@tmXBLabels=ispan(yr1,yr2,time_int) end procedure time_axis_in_years_months(res,time,time_int) begin if (res.and.isatt ( res,"tmXBValues" ) ) then delete(res@tmXBValues) end if if (res.and.isatt ( res,"tmXBLabels" ) ) then delete(res@tmXBLabels) end if res@tmXBMode="Explicit" res@tmXBValues=time(::time_int) utc_date = ut_calendar(time(0), 0) yr1=floattoint( utc_date(:,0)) mo1=floattoint( utc_date(:,1)) ntim=dimsizes(time) utc_date = ut_calendar(time(ntim-1), 0) yr2=floattoint( utc_date(:,0)) mo2=floattoint( utc_date(:,1)) ; Change 2004 to 04 : for example fyr=yr1/100 yr1=yr1-fyr*100 fyr=yr2/100 yr2=yr2-fyr*100 nyr=yr2-yr1+1 label1=month_to_name(ispan(mo1,12,1),1)+(sprinti("%0.2i",yr1)) nlab1=dimsizes(label1) if (nyr.gt.2) label2=month_to_name(ispan(1,12,1),1)+(sprinti("%0.2i",yr2-1)) label3=month_to_name(ispan(1,mo2,1),1)+(sprinti("%0.2i",yr2)) nlab2=dimsizes(label2) nlab3=dimsizes(label3) labels=new( nlab1+nlab2+nlab3, "string") labels(:nlab1-1)=label1 labels(nlab1:nlab1+nlab2-1)=label2 labels(nlab1+nlab2:)=label3 else label2=month_to_name(ispan(1,mo2,1),1)+(sprinti("%0.2i",yr2)) nlab2=dimsizes(label2) labels=new( nlab1+nlab2, "string") labels(:nlab1-1)=label1 labels(nlab1:)=label2 end if res@tmXBLabels=labels(::time_int) end