Errors in plotting time-averaged wind fields

From: Ioannis Koletsis <koletsis_at_nyahnyahspammersnyahnyah>
Date: Tue Mar 26 2013 - 04:13:56 MDT

Hello all,

I am novice in NCL and I have some questions.

Firstly, I work on NCL version 6.0.0-beta

I handle with wind data .nc files (ws(time, height, lat, lon)).

I would like to plot the wind fields but for a specific time period and
area.

I tried to achieve it making the attached script.

The dim_avg function as well as the dimensions re-ordering of my variable
has been already done, but I have faced up a serious problem plotting the
wind field.

When I run the script the following error messages has been displayed on my
screen:

"(0) gsn_csm_contour_map_ce: Fatal: the input data must be 1D or 2D"

"Fatal: Illegal right-hand side type for assignment"

"Fatal: Execute: Error occurred at or near line 158 in file"

Any help would be appreciated..

 

John

 

 

Attached script:

;*************************************************

; Time-Averaged and Plot wind speed fields

;*************************************************

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

 

  f1 = addfile("C4IRCA3_A2_ECHAM5_DM_25km_1991-2000_wss.nc","r")

  time = f1->time

  ws = f1->wss

  lat2d = f1->lat

  lon2d = f1->lon

  pollat = 39.25

  pollon = -162.0

 

  time2 = ut_calendar(time, 0)

 

  year = tointeger(time2(:,0)) ; Convert to integer for

  month = tointeger(time2(:,1)) ; use sprinti

  day = tointeger(time2(:,2))

 

  beg_year = 2000

  end_year = 2000

  beg_month = 12

  end_month = 12

  beg_day = 29

  end_day = 31

 

  ibeg = day_of_year(beg_year,beg_month,beg_day)

  iend = day_of_year(end_year,end_month,end_day)

 

 

;======================================================================

; Select the subregion (Mediterranean Area)

;======================================================================

 

  latS = 30

  latN = 46

  lonW = -10

  lonE = 41

 

  ji = region_ind(lat2d,lon2d,latS,latN,lonW,lonE)

 

  jStrt = ji(0)

  jLast = ji(1)

 iStrt = ji(2)

  iLast = ji(3)

 

  llat2d = lat2d(jStrt:jLast,iStrt:iLast)

  llon2d = lon2d(jStrt:jLast,iStrt:iLast)

 

  nlat = dimsizes(llat2d(:,iStrt))

  nlon = dimsizes(llon2d(jStrt,:))

 

  wsNew = ws(height|:,rlat|jStrt:jLast,rlon|iStrt:iLast,time|ibeg:iend)

  wsAvg = dim_avg_Wrap(wsNew)

 

; wsm = f1->wss

 

 

;======================================================================

; Start graphic section

;======================================================================

 

  wks = gsn_open_wks("png", "Aveg_C4IRCA3_Med_Sea_A2") ; make png image

  gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose color map

 

  res = True ; plot mods desired

 

  res@gsnMaximize = True ; maxmize plot in frame

  res@cnFillOn = True ; turn on color

  res@gsnSpreadColors = True ; automatically choose the
fill colors

  res@cnLinesOn = False ; no contour lines

  res@cnLevelSpacingF = 0.2 ; contour spacing

  res@cnLineLabelsOn = False ; no contour labels

 

 

; =====================================================================

; Create Map and Mask Land

; =====================================================================

 

  res@mpDataBaseVersion = "MediumRes" ; use finer database

  res@mpDataSetName = "Earth..4"

  res@mpProjection = "CylindricalEquidistant"

  res@mpOutlineBoundarySets = "National"

  res@mpFillOn = True ; true for masking

  res@mpGeophysicalLineThicknessF = 1.5

 

  res@mpAreaMaskingOn = True ; masking land

  res@mpMaskAreaSpecifiers = "Ocean"

  res@mpLandFillColor = 0

  res@mpFillDrawOrder = "PostDraw"

 

;=====================================================================

; Laber Bar

;=====================================================================

 

  res@lbLabelAngleF = 0 ; angle labels

  res@lbLabelFontHeightF =.001 ; make labels larger

  res@lbTitleOn = True ; turn on title

  res@lbTitleString = "Wind Speed in m/s"

  res@lbTitleFontHeightF = .010 ; make title smaller

  res@pmLabelBarOrthogonalPosF = .10 ; move whole thing down

 

  res@cnInfoLabelOn = False ; turn off contour info
label

 

  res@lbAutoManage = False ; we control label bar

  res@pmLabelBarDisplayMode = "Always" ; turns on label bar

  res@lbOrientation = "Horizontal" ; ncl default is vertical

  res@pmLabelBarSide = "Bottom" ; default is right

  res@lbLabelStride = 1 ; skip every other label

  res@pmLabelBarWidthF = 0.4 ; default is shorter

  res@pmLabelBarHeightF = 0.1 ; default is taller

  res@lbLabelFontHeightF = .010 ; default is HUGE

  res@lbPerimOn = False ; default has box

  res@lbBoxLinesOn = False

 

  res@pmTickMarkDisplayMode = "conditional"

 

  res@gsnAddCyclic = False

 

 

; ====================================================================

; Set titles

; ====================================================================

 

  res@gsnRightString = "A2 SRES (1991-2000)" ; write a text
up&right below title

  res@gsnRightStringFontHeightF = .010 ; right title font size

  res@gsnLeftStringFontHeightF = .015 ; left title font size

  res@tiMainString = "C4IRCA3 driven by ECHAM5" ; set the main title

  res@tiMainFontHeightF = .020 ; main title font size

 

; Setting tfDoNDCOverlay to True means you have specified the

; exact projection that your data is on, and thus no data

; transformation takes place when the contours are overlaid

; on the map.

;

  res@tfDoNDCOverlay = True

 

 

; ====================================================================

; Zoom in on map

; ====================================================================

 

  res@mpLimitMode = "Corners"

 

  res@mpLeftCornerLatF = llat2d(0,0)

  res@mpLeftCornerLonF = llon2d(0,0)

  res@mpRightCornerLatF = llat2d(nlat-1,nlon-1)

  res@mpRightCornerLonF = llon2d(nlat-1,nlon-1)

  res@mpCenterLonF = 180.0 + pollon

  res@mpCenterLatF = 90.0 - pollat

 

 

 

  plot = gsn_csm_contour_map (wks,wsAvg,res) ; Draw plot

 

 

 

end

 

 

 

 

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

Received on Tue Mar 26 04:14:15 2013

This archive was generated by hypermail 2.1.8 : Tue Apr 02 2013 - 21:23:48 MDT