(no subject)

From: Nagarjuna Rao <dnrao.au_at_nyahnyahspammersnyahnyah>
Date: Wed May 29 2013 - 06:34:41 MDT

Dear All,

   I would like to plot cyclone tracks for the period JJAS data of each
years (for ex: June 2001,july 2001,August 2001,September 2001 like as well
as for the years 2004,2005).Would you please give me any suggestions and
code to do this.
============================================

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Carl Schreck (carl@cicsnc.org) ;; February 2012
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Description: Draw a blank map and put genesis locations on it
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

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
;;***************************************************************
;; These are some parameters that could be useful to have up top
;;***************************************************************

  plotType = "ps"
  plotName = "ibtracs"
  plotDpi = 150 ; only applicable if plotType = "png"

;;***************************************************************
;; data path
;;***************************************************************

  ibtDir = "./"
  ibtPath = "Allstorms.ibtracs_wmo.v03r04.nc"

;;***************************************************************
;; region
;; -1=All, 0=North Atlantic, 1=South Atlantic, 2=West Pacific,
;; 3=East Pacific, 4=South Pacific, 5=North Indian, 6=South Indian
;;***************************************************************

  basin = -1

;; region

  minLon = 50 ; 30
  maxLon = 120
  minLat = 00
  maxLat = 30
  centerLon = 180 ; graphics

;;***************************************************************
;; time period
;;***************************************************************
  year = 2007
  timeUnits = "days since 1800-01-01 00:00:00"
  minTime = ut_inv_calendar( year, 01, 01, 00, 0, 0, timeUnits, 0 )
  maxTime = ut_inv_calendar( year, 12, 31, 18, 0, 0, timeUnits, 0 )

;;***************************************************************
;; Read the data
;;***************************************************************
  inFile = addfile( ibtDir+ibtPath, "r" )

  stormYear = inFile->season
  stormBasin = inFile->genesis_basin
  if( basin.ge.0 ) then
    stormInd = ind( ( year.eq.stormYear ).and.( basin.eq.stormBasin ) )
  else
    stormInd = ind( year.eq.stormYear )
  end if
  stormLat = short2flt( inFile->lat_wmo(stormInd,:) )
  stormLon = short2flt( inFile->lon_wmo(stormInd,:) )
  stormLon = where( stormLon.lt.0, stormLon+360, stormLon )

  printMinMax(stormLat, True)
  printMinMax(stormLon, True)

;;***************************************************************
;; Customize base plot
;;***************************************************************
  res = True
  res@gsnDraw = False
  res@gsnFrame = False
  res@tiMainString = year

;; ...set the spacing of the lat/lon labels
  res@gsnMajorLonSpacing = 20
  res@gsnMinorLonSpacing = 10
  res@gsnMajorLatSpacing = 20
  res@gsnMinorLatSpacing = 10

;; ...map gridlines
  res@mpGridAndLimbOn = True
  res@mpGridLatSpacingF = 10
  res@mpGridLonSpacingF = 10
  res@mpGridMaskMode = "MaskLand"
  res@mpGridLineColor = "blue"

;; ...set the bounds of a map plot
  res@mpMinLatF = minLat
  res@mpMaxLatF = maxLat
  res@mpMinLonF = minLon
  res@mpMaxLonF = maxLon
  res@mpCenterLonF = centerLon

;; ...set map resources
  res@mpFillOn = False
  res@mpGeophysicalLineThicknessF = 2
  res@mpGeophysicalLineColor = "darkgreen"
  res@mpNationalLineColor = "darkgreen"
  res@mpUSStateLineColor = "darkgreen"
  res@mpOutlineBoundarySets = "AllBoundaries"
; res@mpDataBaseVersion = "MediumRes"
; res@mpDataSetName = "Earth..1"

;; Set up an x-y line graph
  xyRes = True
  xyRes@gsnDraw = False
  xyRes@gsnFrame = False
  xyRes@xyMarkLineMode = "MarkLines"
  xyRes@xyMonoDashPattern = True
  xyRes@xyLineColor = "red"
  xyRes@xyLineThicknessF = 2
  xyRes@xyMarker = 1
  xyRes@xyMarkerColor = "black"

;; ...allows png or gif to work
  if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
   ;plotTypeLocal = "eps"
    plotTypeLocal = "ps"
  else
    plotTypeLocal = plotType
  end if

;; ...open the workstation
  wks = gsn_open_wks( plotTypeLocal, plotName )
  gsn_define_colormap( wks, "default" )

  map = gsn_csm_map( wks, res )
  plot = gsn_csm_xy( wks, stormLon, stormLat, xyRes )
  overlay( map, plot )

  draw( map )
  frame( wks )

;; convert the image if necessary
  if( ( plotType.eq."png" ).or.( plotType.eq."gif" ) ) then
    system( "convert -trim +repage -density " + plotDpi + " " \\
      + plotName + "."+plotTypeLocal+" " + plotName + "." + plotType )
    system( "rm -f " + plotName + "."+plotTypeLocal )
  end if

end
============================================================

But above script is used for Annual data(Jan to Dec).I need to
separate a season

wise .Does anybody have any idea how to do this type of work.

  Thanks in advance for any help,

Regards,
D.Nagarjuna Rao.

=============================================

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed May 29 06:34:52 2013

This archive was generated by hypermail 2.1.8 : Tue Jun 11 2013 - 12:03:58 MDT