Re: getting data plotted on a map

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon, 1 Jun 2009 16:36:06 -0600 (MDT)

Joe,

I didn't see where you are attaching lat2d and lon2d to
hourly_mean_precip, so I'm guessing lat2d and lon2d were
already attached when you read in this variable off the file.

If so, is it possible that they are 1D arrays of size 10000 rather
than 2D arrays of size 100 x 100?

To verify this, what does the following report:

   printVarSummary(dimsizes(hourly_mean_precip_at_lat2d))
   printVarSummary(dimsizes(hourly_mean_precip_at_lon2d))

?

--Mary

On Mon, 1 Jun 2009, Joe Grim wrote:

> Hi,
>
> I'm trying to get some WRF output plotted onto a map, but am unable to
> do so. The error messages I get are
> (0) is_valid_latlon2d_attr: Warning: The 'lat2d' attribute must
> either be the same dimension sizes as the data, or one element larger in
> both directions. Your data will most likely not be overlaid on the map
> correctly.
> (0) check_for_y_lat_coord: Warning: Data either does not contain a
> valid latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units'
> attribute equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees
> north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg
> north'
>
> However, I believe that I have addressed each of the possible error
> messages. I have put in printVarSummary commands for the array of
> interest, plus the lat2d and lon 2d arrays, and it appears to me like it
> all looks fine. Would you possibly be able to help me find what I'm
> missing? If so, the CODE is directly below, while the output from the 3
> printVarSummary lines is immediately below that.
>
> Thanks!
>
> Joe Grim
>
>
>
> CODE
> ;*************************************************
> ; NCL Graphics: raster_1.ncl
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;************************************************
> begin
> ;************************************************
> ; open netCDF file
> ;************************************************
> a = addfile("/d2/CFDRC/output/prelim_precip_output.nc","r")
> hourly_mean_precip = a->hourly_mean_precip
> lat2d = a->lat2d
> lon2d = a->lon2d
> ;************************************************
> ; create plots
> ;************************************************
> printVarSummary(hourly_mean_precip)
> printVarSummary(lat2d)
> printVarSummary(lon2d)
> do ii=0,23
> char_ii=sprinti("%0.2i",ii)
> wks = gsn_open_wks("ps","hourly_mean_precip_"+char_ii+"Z") ;
> open a ps file
> res = True ; plot mods desired
>
> gsn_define_colormap(wks,"WhBlGrYeRe") ; Choose colormap.
>
> res_at_gsnMaximize = True ; Maximize plot in frame.
>
> res_at_gsnStringFontHeightF = 0.013
> res_at_gsnRightStringOrthogonalPosF = 0.02
> res_at_gsnLeftStringOrthogonalPosF = 0.02
>
> res_at_cnFillOn = True ; Color plot desired.
> res_at_cnLinesOn = False ; Turn off contour lines .
> res_at_cnLineLabelsOn = False ; Turn off contour labels.
>
> res_at_mpProjection = "LambertConformal"
> res_at_mpLambertParallel1F = 33.0 ; two parallels
> res_at_mpLambertParallel2F = 45.0
> res_at_mpLambertMeridianF = avg(lon2d) ; central meridian
> res_at_mpLimitMode = "LatLon"
>
> res_at_mpMinLatF = min(lat2d) ; map area
> res_at_mpMaxLatF = max(lat2d) ; lat2ds
> res_at_mpMinLonF = min(lon2d) ; and
> res_at_mpMaxLonF = max(lon2d) ; lon2ds
>
> res_at_gsnSpreadColors = True ; Use full range of colormap.
> res_at_gsnSpreadColorStart = 0 ; Start color in colormap.
> res_at_gsnSpreadColorEnd = 190 ; End color in colormap.
> res_at_cnInfoLabelOn = False ; Turn off info label.
>
> res_at_mpGeophysicalLineColor = "red" ; color of continental outlines
> res_at_mpUSStateLineColor = "red"
> res_at_mpGridLineDashPattern = 2 ; lat/lon lines as dashed
> res_at_mpOutlineBoundarySets = "GeophysicalAndUSStates"
>
> res_at_pmTickMarkDisplayMode = "Always" ; Turn on map tickmarks.
>
> res_at_cnFillMode = "RasterFill"
> res_at_cnLevelSelectionMode = "ManualLevels"
> res_at_cnMinLevelValF = 0.1 ; min contour level
> res_at_cnMaxLevelValF = max(hourly_mean_precip) ; max
> contour level
> res_at_cnLevelSpacingF = 1.0 ; contour spacing
>
> res_at_pmLabelBarWidthF = 0.6
> res_at_lbLabelFontHeightF = 0.013
> res_at_lbLabelStride = 2
> res_at_lbBoxLinesOn = False
>
> ;plot =
> gsn_csm_contour(wks,hourly_mean_precip(ii,:,:),res)
> map = gsn_csm_contour_map(wks,hourly_mean_precip(ii,:,:),res)
>
> end do
>
> end
>
>
> OUTPUT from printVarSummary lines
> Variable: hourly_mean_precip
> Type: float
> Total Size: 960000 bytes
> 240000 values
> Number of Dimensions: 3
> Dimensions and sizes: [ncl5 | 24] x [ncl6 | 100] x [ncl7 | 100]
> Coordinates:
> Number Of Attributes: 5
> long_name : Mean precipitation rate for time of day
> units : mm/hour
> lon2d : <ARRAY of 10000 elements>
> lat2d : <ARRAY of 10000 elements>
> _FillValue : -999
>
>
> Variable: lat2d
> Type: float
> Total Size: 40000 bytes
> 10000 values
> Number of Dimensions: 2
> Dimensions and sizes: [g3_x_0 | 100] x [g3_y_1 | 100]
> Coordinates:
> Number Of Attributes: 11
> La1 : 26.856
> Lo1 : -82.448
> Lov : -80.6
> Dx : 3000
> Dy : 3000
> Latin1 : 60
> Latin2 : 30
> units : degrees_north
> GridType : Lambert Conformal Secant or Tangent, Conical or bipolar
> long_name : latitude
> corners : ( 26.856, 26.86411, 29.78162, 29.77304 )
>
>
> Variable: lon2d
> Type: float
> Total Size: 40000 bytes
> 10000 values
> Number of Dimensions: 2
> Dimensions and sizes: [g3_x_0 | 100] x [g3_y_1 | 100]
> Coordinates:
> Number Of Attributes: 11
> La1 : 26.856
> Lo1 : -82.448
> Lov : -80.6
> Dx : 3000
> Dy : 3000
> Latin1 : 60
> Latin2 : 30
> units : degrees_east
> GridType : Lambert Conformal Secant or Tangent, Conical or bipolar
> long_name : longitude
> corners : ( -82.448, -79.20031, -79.14114, -82.52611 )
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 01 2009 - 16:36:06 MDT

This archive was generated by hypermail 2.2.0 : Wed Jun 03 2009 - 12:52:48 MDT