NCL masking error

From: Panday, Prajjwal <ppanday_at_nyahnyahspammersnyahnyah>
Date: Fri Dec 14 2012 - 14:00:37 MST

Hello all,

I am trying to mask a netCDF file. The input file (cru_mon) dimensions is time(12)xlat(360)xlon(320) after subscripting. The mask file dimensions is lat(360)x lon(720).
When I run the script, I am getting an error "warning:ContourPlotInitialize: no valid values in scalar field." and I get nothing in the output map. If I mask the input file by only sorting values greater than 100, I am able to map the data so I know that I am masking incorrectly. Any help is appreciated.
Please see the program below for details.

Thanks,
Prajjwal

---------------------------------------------------------------------------------------------------------

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

; Read in input NetCDF files
dir1 = "C:/Data/Documents/IBIS/reanalysis_data/cru/"
file1 = "cru_pre.nc"
cru_prec = addfile(dir1+file1,"r")
cru_mon = cru_prec->pre(0:11,:,:) ; Dimensions time(12), lat(360), lon(720)
printVarSummary(cru_mon)

; Open mask file
dir2 = "C:/Data/Documents/IBIS/mask/"
file2 = "union.nc"
x2 = addfile(dir2+file2,"r")
basin = x2->mask ; Dimensions lat(360), lon(720)

 range_only = cru_mon
;range_only = mask(cru_mon,(cru_mon.ge.100),True) ; greater than 1mm/day precip
;range_only = mask(cru_mon,conform(cru_mon,basin,(/1,2/)),9) ; mask data by Xingu basin (mask value=9)
range_only = mask(cru_mon,basin,9) ; there is no value in the output and I get an error
printVarSummary(range_only)

;***************************************
; create individual plots
;***************************************
    wks = gsn_open_wks("pdf","cru_xingu") ; open a ps file
    gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap
        res = True ; plot mods desired
    res@cnFillOn = True ; turn on color fill
        res@cnLinesOn = False ; turn off contour lines
        res@gsnSpreadColors = True ; use full range of color map
       plot = gsn_csm_contour_map_ce(wks,range_only(6,:,:),res) ; plotting only the 7th time

en

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Dec 14 14:01:06 2012

This archive was generated by hypermail 2.1.8 : Fri Dec 21 2012 - 10:43:23 MST