Re: plot regular grid data in irregular area

From: Mark Chan <cym263_at_nyahnyahspammersnyahnyah>
Date: Thu May 24 2012 - 09:49:14 MDT

Dear Mary, Can you make a test with the attached data file? It is a bit hard to explain it. I just supply data for plot area, and there is no supplied data for other region. But the plot still cover some area without data, e.g. over the ocean area. Thanks very much. Mark ________________________________ From: Mary Haley <haley_at_ucar.edu> To: Mark Chan <cym263_at_yahoo.com> Cc: "ncl-talk_at_ucar.edu" <ncl-talk_at_ucar.edu> Sent: Thursday, May 24, 2012 4:45 PM Subject: Re: plot regular grid data in irregular area Mark, I'm not sure what you mean by not interpolating to the no-data area. Does your data have missing values? If so, you may need to set the _FillValue attribute after you read in the data:   pwv = stringtofloat(str_get_field(lines(1:),3," "))   pwv@_FillValue = 1e20    ; replace 1e20 with the correct value --Mary On May 24, 2012, at 4:18 AM, Mark Chan wrote: > Dear NCL help, > > The below is an NCL script, which read in data in three columns (lon  lat  values). The data covers an irregular area (e.g. political area) but the data is at regular grids (e.g. all in 0.5/0.5 degree). > I want the exact 'raster' plot without any interpolation to the no-data area. Can one kindly supply any help? > > Thanks very much in advance! > Mark > > ----------------NCL script--------------- > begin >  fname = "vec.dat" >  lines = asciiread(fname,-1,"string") >  lon = stringtofloat(str_get_field(lines(1:),1," ")) >  lat = stringtofloat(str_get_field(lines(1:),2," ")) >  pwv = stringtofloat(str_get_field(lines(1:),3," ")) >  delete(lines) > >  wks = gsn_open_wks("x11","station") >  gsn_define_colormap(wks,"gui_default") > >  res                        = True >  res_at_cnFillOn                = True >  res_at_gsnSpreadColors        = True >  res_at_lbLabelBarOn            = True >  res_at_cnLinesOn              = False >  res_at_cnLineLabelsOn          = False >  res_at_lbLabelAutoStride      = True >  res_at_cnFillMode              = "RasterFill" > >  res_at_sfXArray                = lon >  res_at_sfYArray                = lat > >  res_at_mpMinLatF              = min(lat)-1 >  res_at_mpMinLonF              = min(lon)-1 >  res_at_mpMaxLatF              = max(lat)+1 >  res_at_mpMaxLonF              = max(lon)+1 >  map = gsn_csm_contour_map(wks,pwv,res) > end > > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu May 24 09:49:23 2012

This archive was generated by hypermail 2.1.8 : Fri May 25 2012 - 08:35:50 MDT