forrest@1: ;************************************************ forrest@1: ; output: lat: N->S lon: -180W->180E forrest@1: ;************************************************ forrest@1: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" forrest@1: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" forrest@1: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" forrest@1: ;************************************************ forrest@1: begin forrest@1: forrest@1: ; output forrest@1: forrest@1: model_name = "i01.40cn" forrest@1: forrest@1: diro = "/lustre/wolf-ddn/scratch/hof/cases1/i01.40cn_out/" forrest@1: filo = model_name + "_Fire_C_2076-2100_monthly.nc" forrest@1: c = addfile(diro+filo,"c") forrest@1: filedimdef(c,"year",-1,True) forrest@1: forrest@1: ; input data forrest@1: forrest@1: nlat = 96 forrest@1: nlon = 144 forrest@1: forrest@1: year_start = 2076 forrest@1: year_end = 2100 forrest@1: forrest@1: nyear = year_end - year_start + 1 forrest@1: nmonth = 12 forrest@1: forrest@1: data1 = new((/nyear,nmonth,nlat,nlon/),float) forrest@1: data2 = new((/nyear,nmonth,nlat,nlon/),float) forrest@1: data3 = new((/nyear,nmonth,nlat,nlon/),float) forrest@1: date = new((/nyear,nmonth/),integer) forrest@1: forrest@1: ; input dir forrest@1: diri = "/lustre/wolf-ddn/scratch/hof/cases1/"+model_name+"/" forrest@1: forrest@1: do m = 0,nyear-1 forrest@1: year = year_start + m forrest@1: do n = 0,nmonth-1 forrest@1: nn = n+1 forrest@1: date(m,n) = year*100 +nn forrest@1: forrest@1: ; input file forrest@1: if (nn .ge. 10) then forrest@1: fili = model_name+".clm2.h0."+year+"-"+nn+".nc" forrest@1: else forrest@1: fili = model_name+".clm2.h0."+year+"-0"+nn+".nc" forrest@1: end if forrest@1: forrest@1: ; print (fili) forrest@1: forrest@1: g = addfile (diri+fili,"r") forrest@1: forrest@1: b1 = g->COL_FIRE_CLOSS forrest@1: data1(m,n,:,:) = (/b1(0,:,:)/) forrest@1: forrest@1: b2 = g->NPP forrest@1: data2(m,n,:,:) = (/b2(0,:,:)/) forrest@1: forrest@1: b3 = g->NEE forrest@1: data3(m,n,:,:) = (/b3(0,:,:)/) forrest@1: end do forrest@1: end do forrest@1: forrest@1: ; name dimensions and assign coordinate variables forrest@1: forrest@1: data1!0 ="year" forrest@1: data1!1 ="month" forrest@1: data1!2 = "lat" forrest@1: data1!3 = "lon" forrest@1: data1@long_name = b1@long_name forrest@1: data1@units = b1@units forrest@1: data1@_FillValue = b1@_FillValue forrest@1: forrest@1: data2!0 ="year" forrest@1: data2!1 ="month" forrest@1: data2!2 = "lat" forrest@1: data2!3 = "lon" forrest@1: data2@long_name = b2@long_name forrest@1: data2@units = b2@units forrest@1: data2@_FillValue = b2@_FillValue forrest@1: forrest@1: data3!0 ="year" forrest@1: data3!1 ="month" forrest@1: data3!2 = "lat" forrest@1: data3!3 = "lon" forrest@1: data3@long_name = b3@long_name forrest@1: data3@units = b3@units forrest@1: data3@_FillValue = b3@_FillValue forrest@1: forrest@1: date!0 ="year" forrest@1: date!1 ="month" forrest@1: date@long_name = "date: yyyymm" forrest@1: forrest@1: c->COL_FIRE_CLOSS = data1 forrest@1: c->NPP = data2 forrest@1: c->NEE = data3 forrest@1: c->date = date forrest@1: c->area = g->area forrest@1: forrest@1: print (date) forrest@1: forrest@1: end