Hi Donna,
You're close. You set up degrees_east and degrees_north as units
attributes of the xlon and xlat arrays. But those arrays are not attached
to your x array as coordinate variables, and the x array is the array you
are attempting to plot.
All you need to do is the following:
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
begin
a = addfile("ias_topography.nc","r")
x = a->Topography ; no reason to specify (Latitude|:,Longitude|:)
; as you are not reordering dimensions
x&Latitude@units = "degrees_north"
x&Longitude@units = "degrees_east"
printVarSummary(x) ; optional, prints out array info
printVarSummary(x&Latitude) ; optional
printVarSummary(x&Longitude) ; optional
wks = gsn_open_wks("ps","ce") ; open a ps file
plot = gsn_csm_contour_map_ce(wks,x,False) ; create a default plot
end
Adam
> I took an example file "ce_1.ncl" and read in my topography nc file.
> While a .ps file is generated, I get the errors that my variable doesn't
> have coordinates with the units of "degrees_east" or "degrees_north".
> --------expressly:
> check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> A valid latitude coordinate array should have a 'units' attribute equal
> to one of the following values:
> 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> A valid longitude coordinate array should have a 'units' attribute equal
> to one of the following values:
> 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> --------
>
>
> Here is my ncl file:
> ;*************************************************
> ; ce_1.ncl
> ;
> ; Concepts illustrated:
> ; - Drawing black-and-white contours over a cylindrical equidistant map
> ;
> ;************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;************************************************
> begin
> ;************************************************
> ; read in netCDF file
> ;************************************************
> a = addfile("ias_topography.nc","r")
> ;************************************************
> ; read in zonal winds
> ;************************************************
> xlat = a->Latitude
> xlon = a->Longitude
>
> xlat!0 = "lat"
> xlat@units = "degrees_north"
> xlon!0 = "lon"
> xlon@units = "degrees_east"
>
> x = a->Topography( Latitude | : , Longitude | : )
> ; ;x = a->Topography(0,:,:)
> x!0 = "xlat"
> x!1 = "lon"
> x@units = "m"
>
> ;************************************************
> ; create default plot
> ;************************************************
> wks = gsn_open_wks("ps","ce") ; open a ps file
> plot = gsn_csm_contour_map_ce(wks,x,False) ; create a default plot
> end
>
> I feel like I'm having a DUH moment. Can I get help getting
> un-stuck?
>
> My nc file looks like:
> ncl_filedump ias_topography.nc
> Copyright (C) 1995-2009 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 5.1.1
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> Variable: f (file variable)
>
> filename: ias_topography
> path: ias_topography.nc
> file global attributes:
> dimensions:
> Longitude = 401
> Latitude = 261
> variables:
> float Longitude ( Longitude )
> long_name : Longitude
> units : deg E
> FORTRAN_format : f8.3
>
> float Latitude ( Latitude )
> long_name : Latitude
> units : deg N
> FORTRAN_format : f8.3
>
> float Topography ( Latitude, Longitude )
> long_name : Topography
> units : m
> FORTRAN_format : f8.1
> _FillValue : -99
>
> _______________________________________________
> 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 Wed Jan 26 17:59:00 2011
This archive was generated by hypermail 2.1.8 : Mon Jan 31 2011 - 10:38:24 MST