Issue with X-Axis Labeling and Values; Using tmXBValues/Labels, ispan

From: James Madden <jmmadden_at_nyahnyahspammersnyahnyah>
Date: Tue Sep 10 2013 - 14:42:44 MDT

Hello everyone,

I am having a small difficulty with the x-axis labeling. I am trying to do
a simple cross section of my WRF data, from point A to point B, as dictated
by certain specified latitude and longitude data (which comes from my
CALIPSO data).

I am getting x-axis labels in the correct format, however the x-axis is not
complete. The x-axis only has the first several pieces of latitude and
longitude data, and the rest doesn't appear; basically, there is way more
latitude and longitude information than what the x-axis indicates.

I have attempted to stride the data in an attempt to have all of the
coordinate information, and to use the 'npts' mechanism in ispan, but the
latter method only spaces the coordinate data even further.

I have attached a graphic of my plot, and I have also attached a txt file
that contains all my latitude and longitude information.

The problem is most likely near tmXBValues / tmXBLabels, or at "xcoord".

My code is below. Thank you very much.

Mike

Code:

; This script will take a cross section of your WRF data, with specified
; latitude and longitude coordinates.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/ut_string.ncl"
load "color_map.ncl"

begin

type = "x11"
wks = gsn_open_wks(type,"WRF Cross Section")
gsn_define_colormap(wks,"BlAqGrYeOrReVi200")

; Load CALIPSO latitude and longitude data

  b =
addfile("/import/archive/u1/uaf/jmmadden/WILDFIRE2009/CALIPSOdata/SUBSETS/CAL_LID_L1-ValStage1-V3-01.2009-06-21T12-23-05ZD.hdf_Subset.hdf","r")

; Work with the time fields to get a valid time string
   time = (/b->Profile_Time/)
   time@units = "seconds since 1993-01-01 00:00"
   tstring = ut_string(time(:,0), "%Y-%N-%D %H:%M:%S")

   xlat = (/b->Latitude/)
   xlon = (/b->Longitude/)
   xlabel = sprintf("%.2f",xlat)+"~C~"+sprintf("%.2f",xlon)

;print(xlat) ; xlat descends from 67.. to 63...
;print(xlon) ; xlon goes from -150 to ~-154....

asciiwrite("xlabel",xlabel)

n = dimsizes(xlat(:,0))
nn = dimsizes(xlon(:,0))

;print(n) ; n is 1319 (1318 in some files, that's ok)
;print(nn) ; n is 1319 (1318 in some files, that's ok)

minlat = xlat(n-1,0)
maxlat = xlat(0,0)
minlon = xlon(nn-1,0)
maxlon = xlon(0,0)

;print(maxlat) ; this is 67...
;print(maxlon) ; this is -150...

lats = (/maxlat,minlat/)
lons = (/maxlon,minlon/)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Read WRF Output File

a =
addfile("/import/archive/u1/uaf/jmmadden/WILDFIRE2009/WRFouts/wrfout_d01_2009-06-21_00:00:00"+".nc","r")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

  times = wrf_user_getvar(a,"times",-1) ; get times in the file
  ntimes = dimsizes(times) ; number of times in the file

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Set some basic resources
  res = True
  res@MainTitle = "REAL-TIME WRF"
  res@Footer = False

  pltres = True

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; HOURLY LOOP OF PARTICULATE MATTER

do it = 12,14 ; loop over 24 hours, focused only on 12th and 13th hour

  print("Working on time: " + times(it) )
  res@TimeLabel = times(it) ; Set Valid time to use on plots

; First get the variables we will need
    tc = wrf_user_getvar(a,"tc",it) ; T in C
    z = wrf_user_getvar(a, "z",it) ; grid point height
    pm = a->PM2_5_DRY(it,:,:,:)

  loc = wrf_user_latlon_to_ij(a,lats,lons)

           ys = loc(0,0) ; Starting y (j) location
           ye = loc(1,0) ; Ending y (j) location
           xs = loc(0,1) ; Starting x (i) location
           xe = loc(1,1) ; Ending x (i) location

; Interpolate WRF Model data vertically
  angle = 0
  opts = False ; start and end points not
specified

; Establish starting and end points in domain
  plane = new(4,float)
  plane = (/ xs,ys, xe,ye /) ; start x;y & end x;y point
  pm_plane = wrf_user_intrp3d(pm,z,"v",plane,angle,opts)
  tc_plane = wrf_user_intrp3d(tc,z,"v",plane,angle,opts)

; Plotting Options for PM
  opts_pm = res
  opts_pm@cnLevelSelectionMode = "ExplicitLevels"
  Levels = (/3.,3.5,4.,4.5,5.,5.5,6.,6.5,7.,8.,9.,11.,13.,15./)
  opts_pm@cnFillOn = True
  opts_pm@cnFillMode = "RasterFill"
  opts_pm@cnRasterSmoothingOn = True
  opts_pm@cnLinesOn = False ; turn off contour lines
  opts_pm@cnLineLabelsOn = True ; turn off contour labels
  opts_pm@tiYAxisOn = True

; Set stride intervals for x-axis

; xcoord = ispan(0,dimsizes(xlat(:,0))-1,1)
   xcoord = ispan(0,dimsizes(pm_plane(0,:)) - 1, 1)
  stride = dimsizes(tstring)/15

        opts_pm@tmXTOn = False
        opts_pm@tmYROn = False
        opts_pm@tmXBMode = "Explicit"
        opts_pm@tmXBValues = xcoord(::stride)
        opts_pm@tmXBLabels = xlabel(::stride,0)
        opts_pm@tmXBLabelFontHeightF = 0.001

; Plotting options for Temperature
  opts_tc = res
  opts_tc@cnInfoLabelOrthogonalPosF = 0.00
  opts_tc@ContourParameters = (/ 5. /)

 contour_pm = wrf_contour(a,wks,pm_plane,opts_pm)
 contour_tc = wrf_contour(a,wks,tc_plane,opts_tc)

plot = wrf_overlays(a,wks,(/contour_pm,contour_tc/),pltres)

end do
end

-- 
*Mike Madden
*
*Graduate Research Assistant *
*Department of Atmospheric Sciences *
*University of Alaska Fairbanks*
*IARC 338N
*
*Office:  (907) 474-7618
*
*Cell: (417) 439-2830
---------------------------------------------------------------------
"Buy the ticket, take the ride."  Hunter S. Thompson
*



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

graphic_for_ncl_forum.GIF
Received on Tue Sep 10 14:42:58 2013

This archive was generated by hypermail 2.1.8 : Mon Sep 16 2013 - 13:43:52 MDT