Re: plot regular grid data in irregular area

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu May 24 2012 - 08:45:27 MDT

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@cnFillOn = True
> res@gsnSpreadColors = True
> res@lbLabelBarOn = True
> res@cnLinesOn = False
> res@cnLineLabelsOn = False
> res@lbLabelAutoStride = True
> res@cnFillMode = "RasterFill"
>
> res@sfXArray = lon
> res@sfYArray = lat
>
> res@mpMinLatF = min(lat)-1
> res@mpMinLonF = min(lon)-1
> res@mpMaxLatF = max(lat)+1
> res@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 08:45:35 2012

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