Re: assigning coordinate values

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 19 Mar 2008 16:42:23 -0600

Hello,

Need more info.

[1] Are the data randomly spaced?

[2] Do the variables lat and lon have units attributes?
     These should be something like "degrees_north" and "degrees_east"

[3] If the data are supposed to be on a regular grid then "triple2grid"
should convert themt o a SNOWDP(nlat,mlon) array.
http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid.shtml

The following should plot out your one dimensional daya data.

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
  a = addfile (....)
  SNOWDP = a->SNOWDP ;4897 columns
  lat = a->cols1d_lat ;4897 columns with lats
  lon = a->cols1d_lon ;4897 columns with lons

 lat_at_units = "degrees_north" ; assign if not already part of lat
 lon_at_units = "degrees_east"

  wks = gsn_open_wks("ps","gina")
  gsn_define_colormap(wks,"WhViBlGrYeOrRe")
  gsn_reverse_colormap(wks)

  res = True
  res_at_gsnFrame = False ; So we can draw markers
  res_at_gsnMaximize = True
  res_at_gsnSpreadColors = True
  res_at_gsnSpreadColorEnd = 90
  res_at_pmTickMarkDisplayMode = "Always"

  res_at_trGridType = "TriangularMesh" ; The default if
you have 1D data

  res_at_cnFillOn = True
  res_at_cnLinesOn = True
  res_at_cnLineLabelsOn = True
  res_at_tiMainString = "Gina Data"
  res_at_sfXArray = lon
  res_at_sfYArray = lat

  res_at_mpProjection = "CylindricalEquidistant"
  res_at_mpMinLatF = min(lat) ; user can specify any values
  res_at_mpMaxLatF = max(lat)
  res_at_mpMinLonF = min(lon)
  res_at_mpMaxLonF = max(lon)

; Draw the map (frame won't get advanced because gsnFrame was set to False).
;
  map = gsn_csm_contour_map(wks,SNOWDP,res)
;
; Draw markers on the plot in the lat/lon locations.
;
  mkres = True
  mkres_at_gsMarkerIndex = 17 ; Filled circle
  mkres_at_gsMarkerSizeF = 0.015
  gsn_polymarker(wks,map,lon,lat,mkres)
  frame(wks) ; Now advance the frame.
end

Gina Henderson wrote:
> Hi there,
>
> I have a simple problem, at least I think this should be simple to do
> but I am going about it in the wrong way in ncl. I am trying to read
> some clm variables from a clm history tape that are on the column
> level. It is a 1-D var with no lat and lon attributes attached to it
> but these are found in two other variables. I want to graph these up
> but am having trouble making them all one 3-D variable as I get errors
> saying the coordinate fields are empty. I'm sure the problem is in my
> file handling but I have not found any example scripts that deal with
> data of this nature.
>
> --------------------------------------------------------------------------------------
>
> SNOWDP = a->SNOWDP(:) ;4897 columns
> lat = a->cols1d_lat(:) ;4897 columns with lats
> lon = a->cols1d_lon(:) ;4897 columns with lons
> .
> .
> .
> NEWSNOW = (/SNOWDP,lat,lon/)
>
> Thanks, Gina.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Mar 19 2008 - 16:42:23 MDT

This archive was generated by hypermail 2.2.0 : Sun Mar 23 2008 - 15:01:36 MDT