hourly daily pentad monthly

在知道calculate_monthly_values前我是这么做的:

3 hourly to daily

var_name=get_script_prefix_name
year=1958
fils=systemfunc("ls /data1/DuanGroup/zy/jra55/55/4times/"+var_name+"/*"+year+"*.nc")
a_in=addfiles(fils,"r")
names = getfilevarnames(a_in[0])       ; get CCM file's variable names and print them
print (names)

that_var=a_in[:]->$names(3)$
printVarSummary(that_var)
dims=dimsizes(that_var)
ntime=dims(0)
nlat=dims(1)
nlon=dims(2)
that_var_onedim=ndtooned(that_var)
that_var_ndim=onedtond(that_var_onedim,(/ntime/8,8,nlat,nlon/))
that_var_daily=dim_avg_n_Wrap(that_var_ndim,1)
copy_VarCoords(that_var(::8,:,:),that_var_daily)
printVarSummary(that_var_daily)

pentad to daily

target_var_num=7

file_list=systemfunc("ls /public/damtest/zy/data/godas_pentad/"+year+"/*.grb")
f_in=addfile(file_list(0),"r")
var_names=getfilevarnames(f_in)
print(var_names)
x5_0=f_in->$var_names(target_var_num)$
dim_x5_0 = dimsizes( x5_0 ) 
x5=new((/73,dim_x5_0(0),dim_x5_0(1)/),typeof(x5_0),x5_0@_FillValue)
do i=0,72
    f_in=addfile(file_list(i),"r")
    var_names=getfilevarnames(f_in)
    x5(i,:,:)=f_in->$var_names(target_var_num)$
end do
x5!0="ncl_join"

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;process
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
dim_x5 = dimsizes( x5 ) 
ntim5 = dim_x5(0) 
nlat = dim_x5(1) 
nlon = dim_x5(2) 
 
ntim = 5*ntim5 ; 5x the number of pentads = # days 
 
time5 = ispan(3,ntim,5) 
time5!0 = "time5" 
time5_at_units = "pentad day" 
time5&time5 = time5 
 
time = ispan(1,ntim,1) ; create time/day coordinate variable 
time!0 = "time" 
time_at_units = "day" 
time&time = time 
 
xTemp = linint1_Wrap (time5, x5(g0_lat_1|:,g0_lon_2|:,ncl_join|:), False, time, 0) 
xDay = xTemp(time|:,g0_lat_1|:,g0_lon_2|:) 
delete(xTemp) 
copy_VarAtts(x5, xDay) 
 
xDay!0 = "time" 
xDay!1 = "lat" 
xDay!2 = "lon" 
xDay&time= time 
xDay&lat = x5&g0_lat_1 
xDay&lon = x5&g0_lon_2 
 
printVarSummary( xDay ) 
printMinMax( xDay,False ) 

pentad to monthly

file_list=systemfunc("ls /data1/DuanGroup/zy/godas/pentad/equ/thermo_equ_*heat_budget_detail_glo_tro_.nc")
a=addfiles(file_list,"r")
sst1=a[:]->sw
 utc_date = cd_calendar(a[:]->time, 0)
 year_   = tointeger(utc_date(:,0))    ; Convert to integer for
 month  = tointeger(utc_date(:,1))    ; use sprinti 
 day    = tointeger(utc_date(:,2))
 hour   = tointeger(utc_date(:,3))
 minute = tointeger(utc_date(:,4))
 second = utc_date(:,5)

sst_6=new((/year_num,181,361/),"double")
do i=year_start,year_end
    month_id:=ind(month.eq.target_month.and.year_.eq.i)
    tmp=dim_avg_n_Wrap(sst1(month_id,:,:),0)
    sst_6(i-year_start,:,:)=tmp
end do
printVarSummary(sst_6)
printMinMax(sst_6, False)

你可能感兴趣的:(hourly daily pentad monthly)