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

From: Lorraine Manlay <lorraine.manlay_at_nyahnyahspammersnyahnyah>
Date: Sun, 12 Apr 2009 22:47:14 +0200

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

tempe_500.jpg
Received on Sun Apr 12 2009 - 14:47:14 MDT

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