forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" forrest@0: load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" forrest@0: forrest@0: begin forrest@0: nlat = 3600 forrest@0: mlon = 7200 forrest@0: forrest@0: diri = "/fis/cgd/cseg/people/jeff/clamp/" forrest@0: fili = "Npp_0.05deg_mean.int16" forrest@0: forrest@0: diro = "/fis/cgd/cseg/people/jeff/clamp/" forrest@0: filo = "Npp_0.05deg_mean_3.nc" forrest@0: c = addfile(diro+filo,"c") forrest@0: forrest@0: ; I think (a) the file is "little endian"; read into short forrest@0: ; (b) the _FillValue is 32700 forrest@0: forrest@0: setfileoption("bin","ReadByteOrder","LittleEndian") forrest@0: xShort= fbindirread(diri+fili,0, (/nlat,mlon/), "short") forrest@0: xShort@_FillValue= inttoshort(32700) forrest@0: forrest@0: ;;xShort@scale_factor = ????? forrest@0: ;;xShort@add_offset = ????? forrest@0: forrest@0: x = short2flt( xShort ) forrest@0: forrest@0: ;;print(xShort(:,1800)+" "+x(:,1800)) ; look at the values forrest@0: delete(xShort) forrest@0: forrest@0: x@long_name = "net primary production" forrest@0: x@units = "gC/m^2/year" forrest@0: ; x@_FillValue = -17281 ; orig fill forrest@0: x@_FillValue = 1e20 ; new fill forrest@0: forrest@0: lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north") forrest@0: lat = (/ lat(::-1) /) ; make N->S forrest@0: lon = lonGlobeFo(mlon, "lon", "longitude", "degrees_east") forrest@0: lon = (/ lon - 180. /) ; subtract 180 from all values forrest@0: lon&lon = lon ; update coordinates forrest@0: forrest@0: x!0 = "lat" forrest@0: x!1 = "lon" forrest@0: x&lat= lat forrest@0: x&lon= lon forrest@0: forrest@0: c->NPP = x forrest@0: forrest@0: exit forrest@0: forrest@0: ;************************************************ forrest@0: ; create default plot forrest@0: ;************************************************ forrest@0: forrest@0: setvalues NhlGetWorkspaceObjectId() forrest@0: "wsMaximumSize" : 199999999 forrest@0: end setvalues forrest@0: forrest@0: wks = gsn_open_wks("ps","Npp_rdBinPlt") ; open a ps file forrest@0: ;gsn_define_colormap(wks,"wgne15") ; choose colormap forrest@0: forrest@0: res = True ; Use plot options forrest@0: res@cnFillOn = True ; Turn on color fill forrest@0: res@cnFillMode = "RasterFill" ; Turn on raster color forrest@0: res@lbLabelAutoStride = True forrest@0: res@cnLinesOn = False ; Turn off contourn lines forrest@0: ;res@gsnSpreadColors = True ; use full colormap forrest@0: res@mpFillOn = False ; Turn off map fill forrest@0: forrest@0: ;res@cnLevelSelectionMode = "ManualLevels" ; Manual contour invtervals forrest@0: ;res@cnMinLevelValF = ; Min level forrest@0: ;res@cnMaxLevelValF = ; Max level forrest@0: ;res@cnLevelSpacingF = ; interval forrest@0: res@tiMainString = fili forrest@0: forrest@0: plot = gsn_csm_contour_map_ce(wks,x,res) forrest@0: forrest@0: end forrest@0: