;************************************************* ; Calculate and export time-averaged wind speed ;************************************************* load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" begin f1 = addfile("C4IRCA3_A2_ECHAM5_DM_25km_1961-1970_wss.nc","r") time = f1->time ws = f1->wss ws@_FillValue = 1.e+30 lat2d = f1->lat lon2d = f1->lon ;============================================= ; Select the subregion (Mediterranean Area) ;============================================= latS = 30 latN = 46 lonW = -10 lonE = 41 ji = region_ind(lat2d,lon2d,latS,latN,lonW,lonE) jStrt = ji(0) jLast = ji(1) iStrt = ji(2) iLast = ji(3) llat2d = lat2d(jStrt:jLast,iStrt:iLast) llon2d = lon2d(jStrt:jLast,iStrt:iLast) ws2 = ws(:,:,jStrt:jLast,iStrt:iLast) time3 = ut_calendar(time, -2) diro = "./" ; output directory filo = "C_A2_1961_1970_Med_2.dat" ; output file name patho= diro+filo ; system("/bin/rm -f "+patho) ; rm any pre-existing file ; txt = lat2d+", "+lon2d+", "+ws ; create text variable ; print(txt(0:99)) ; print first 100 value fbindirwrite(filo,(time3)) fbindirwrite(filo,(llat2d)) fbindirwrite(filo,(llon2d)) fbindirwrite(filo,(ws2)) ; asciiwrite(patho, txt) ; write text file ; print(llat2d(19,19)) ; print(llon2d(19,19)) ; print(ws2(2,0,19,19)) end