Re: Fwd: mask on 1D (X Y Z) satellite data

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 13 Apr 2009 09:49:57 -0600 (MDT)

Hi Lorraine,

In order to contour random 1D data using the triangular mesh
capability, you need to include additional information about how the
triangles are connected via the "sfElementNodes" resource.

See the two examples at:

   http://www.ncl.ucar.edu/Applications/trimesh.shtml

which both set this resource.

If you don't have this information, then I believe the only
option you have is to regrid your data to a 2D array.

Here are a couple of functions for regridding random data:

   http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid.shtml
   http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml

In addition, you can use poisson_grid_fill to fill in missing values:

http://www.ncl.ucar.edu/Document/Functions/Built-in/poisson_grid_fill.shtml

You can see an example of triple2grid at:

   http://www.ncl.ucar.edu/Applications/narr.shtml#ex3

You may want to double-check your satellite data, however, and see if
you already have 2D lat/lon arrays associated with it. If you do, then
you can use these arrays instead for sfXArray and sfYArray, and you
don't need to worry about setting sfElementNodes or regridding.

--Mary

On Sun, 12 Apr 2009, Lorraine Manlay wrote:

> Hi ncl users,
> I try to do some plot of temperature from satellite data.
>
> The data are 1D : lon lat T (temperature).
>
> I use sfXArray and sfYArray to generate something that I can plot after
> with gsn_csm_contour_map.
> The result is fine, you can see it in the attach file. And the script is
> paste below.
>
> My question is :
> Is there a possibility to mask the zone were the contour is not "physical",
> i.e where there is no point ... In fact I just want the zone that are
> covered by the satellite and I want to mask the ones that are not. Is it
> possible ? Is there a simple solution using mask ?
>
> Thanks ncl users.
> Lorraine.
>
>
>
> 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/shea_util.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> begin
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;; Load data
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> fldname="airsr_t"
>
> infile="AllMyData2006100200.nc"
>
> print("Reading file: "+infile)
> a=addfile(infile,"r")
>
> T=a->$fldname$ ; load Temperature data
> lat=a->lat(:)
> lon=a->lon(:)
> lev=a->lev(:)
>
> printVarSummary(T)
> printVarSummary(lat)
> printVarSummary(lon)
> printVarSummary(lev)
>
>
> indice_col= 0 ;
>
> T_X=T(:,indice_col)
> T_X=T_X-273.15
>
> T_QC=T(:,2)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;; Just 1 level : indice_level, make a mask
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> indice_level=5
>
> indice_qc=0
>
> T_mask=T_X
> T_mask=mask(T_X,\
> (lev.eq.lev(indice_level).and.(T_QC.gt.indice_qc)),\
> True)
>
> lon_mask=lon
> lat_mask=lat
>
> lon_mask=mask(lon,\
> (lev.eq.lev(indice_level).and.(T_QC.gt.indice_qc)),\
> True)
>
> lat_mask=mask(lat,\
> (lev.eq.lev(indice_level).and.(T_QC.gt.indice_qc)),\
> True)
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;;; Plot
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
> wks = gsn_open_wks("eps","tempe_"+lev(indice_level)*0.01)
> gsn_define_colormap(wks,"rainbow")
> gsn_reverse_colormap(wks)
>
> res = True
> res_at_gsnFrame = False
> res_at_gsnMaximize = True
>
> res_at_gsnSpreadColors = True
> res_at_gsnSpreadColorStart = 2
> res_at_gsnSpreadColorEnd = 90
>
> res_at_mpMaxLatF = -40.
> res_at_gsnPolar = "SH"
> res_at_cnRasterModeOn = True
>
>
> res_at_trGridType = "TriangularMesh"
>
> res_at_cnLineLabelPlacementMode = "Constant"
>
> res_at_cnFillOn = True
> res_at_cnFillMode = "RasterFill"
> res_at_cnLinesOn = False
> res_at_cnLineLabelsOn = False
>
> res_at_lbLabelStride = 2
>
> res_at_sfXArray = lon_mask
> res_at_sfYArray = lat_mask
>
> res_at_tiMainString = "Temperature at
> "+lev(indice_level)*0.01+" hPa"
>
> map = gsn_csm_contour_map(wks,T_mask,res)
>
> ; Draw markers on the plot in the lat/lon locations.
>
> mkres = True
> mkres_at_gsMarkerIndex = 17
> mkres_at_gsMarkerSizeF = 0.0005
>
> gsn_polymarker(wks,map,lon_mask,lat_mask,mkres)
>
> frame(wks)
>
> end
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Apr 13 2009 - 09:49:57 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 16 2009 - 10:05:49 MDT