1 ;_______________________________________________________________________________________
2 ;To run the script type:
3 ; ncl plotfmt_nc.ncl {input file}
6 ; ncl plotfmt_nc.ncl 'inputFILE="FILE:2005-06-01_00.nc"'
7 ;_______________________________________________________________________________________
9 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
10 load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
11 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
15 ; Make sure we have a datafile to work with
16 if (.not. isvar("inputFILE") ) then
18 print(" ### MUST SUPPLY a inputFILE ### ")
20 print(" Something like: ")
21 print(" ncl plotfmt_nc.ncl inputFILE=FILE:2005-06-01_00.nc")
22 print(" REMEMBER TO ADD QUOTES" )
23 print(" Refer to the information at the top of this file for more info and syntax" )
27 inFILE = addfile(inputFILE,"r")
29 ; We generate plots, but what kind do we prefer?
36 wks = gsn_open_wks(type,"outf")
39 vNames = getfilevarnames (inFILE)
40 nNames = dimsizes (vNames)
44 res@gsnSpreadColors = True
45 res@lbLabelAutoStride= True
49 print("VAR = " + vNames(n) )
50 var = inFILE->$vNames(n)$
53 lat = new ( dims(0), float)
54 lon = new ( dims(1), float)
55 lon@units = "degrees_east"
56 lat@units = "degrees_north"
60 if (var@projection .eq. 0) then ;Cylindrical Equidistant
62 lat(i) = lat(i-1) + var@deltalat
65 lon(i) = lon(i-1) + var@deltalon
69 if (var@projection .eq. 1) then ; Mercator
72 res1@TRUELAT1 = var@truelat1
73 res1@DX = var@dx*1000.
74 res1@DY = var@dy*1000.
83 loc = wrf_ij_to_ll (var@nx,var@ny,res1)
85 res@gsnAddCyclic = False
86 res@mpLimitMode = "Corners"
87 res@mpLeftCornerLatF = lat(0)
88 res@mpLeftCornerLonF = lon(0)
89 res@mpRightCornerLatF = loc(1)
90 res@mpRightCornerLonF = loc(0)
91 res@tfDoNDCOverlay = True
92 res@mpProjection = "mercator"
95 if (var@projection .eq. 3) then ; Lambert Conformal
98 res1@TRUELAT1 = var@truelat1
99 res1@TRUELAT2 = var@truelat2
100 res1@STAND_LON = var@xlonc
101 res1@DX = var@dx*1000.
102 res1@DY = var@dy*1000.
103 res1@REF_LAT = lat(0)
104 res1@REF_LON = lon(0)
111 loc = wrf_ij_to_ll (var@nx,var@ny,res1)
113 res@gsnAddCyclic = False
114 res@mpLimitMode = "Corners"
115 res@mpLeftCornerLatF = lat(0)
116 res@mpLeftCornerLonF = lon(0)
117 res@mpRightCornerLatF = loc(1)
118 res@mpRightCornerLonF = loc(0)
119 res@tfDoNDCOverlay = True
120 res@mpProjection = "LambertConformal"
121 res@mpLambertParallel1F = var@truelat1
122 res@mpLambertParallel2F = var@truelat2
123 res@mpLambertMeridianF = var@xlonc
126 if (var@projection .eq. 4) then ;Gaussian
127 delta = 2.*(var@startlat)/(2.*var@nlats-1)
128 if (var@startlat .ge. 80.) then
132 lat(i) = lat(i-1) + delta
135 lon(i) = lon(i-1) + var@deltalon
144 var@description = var@level +" "+ var@description
146 ;map = gsn_csm_contour_map_ce(wks,var,res)
147 map = gsn_csm_contour_map(wks,var,res)