[ncl-talk] plotting model output where x/y are not lat/lon
Will Hobbs
Will.Hobbs at utas.edu.au
Thu Aug 27 21:35:42 MDT 2015
Mira
It looks like you have 2-d lat and lon arrays associated with your data,
as is often the case with models (especially ocean models).
This can be plotted by NCL without regridding, see the examples here:
http://www.ncl.ucar.edu/Applications/ease.shtml
Although you are not using the EASE grid, the principal is exactly the
same:
1. Set your map plot grid type resource
>res at trGridTrype = "TriangularMesh"
2. Set the lat and lon arrays as attributes of the array you are plotting,
so if your array is 'x'
> x at lat2d = LAT
> x at lon2d = LON
The just use one of the gsn_csm contour map plotting functions as normal.
I hope that's clear.
Will
On 28/08/15 1:27 PM, "Yuqiang Zhang" <yuqiangzhang.thu at gmail.com> wrote:
>Hi Mira,
>
>Check the link here
>http://www.ncl.ucar.edu/FAQ/
>For Q 27:
>
>When I call one of the gsn_csm_xxxx_map plotting scripts, I get an error
>message about a units attribute not being correct.
>If you are using one of the gsn_csm_xxx_map functions to overlay data on a
>map, and seeing one or both of the following error messages:
>
> (0) is_valid_lat_ycoord: Warning: The units attribute of
> the Y coordinate array is not set to one of the allowable
> units values (i.e. 'degrees_north'). Your latitude labels
> may not be correct.
>
> (0) is_valid_lat_xcoord: Warning: The units attribute of
> the X coordinate array is not set to one of the allowable
> units values (i.e. 'degrees_east'). Your longitude labels
> may not be correct.
>then this means that your data contains coordinate arrays, but the
>coordinate arrays either don't have the necessary "units" attribute, or
>it's
>not set to one of the allowable values ("degrees_east" for longitude
>values
>and "degrees_north" for latitude values).
>If your coordinate arrays are indeed degrees east and degrees north, then
>you can set the units attribute as follows (this code snippet assumes your
>data array is called "data" and that the coordinate arrays are called
>"lat"
>and "lon"):
>
> data&lat at units = "degrees_north"
> data&lon at units = "degrees_east"
>
>Regards,
>Yuqiang
>
>-----Original Message-----
>From: ncl-talk-bounces at ucar.edu [mailto:ncl-talk-bounces at ucar.edu] On
>Behalf
>Of mberdahl at envsci.rutgers.edu
>Sent: Thursday, August 27, 2015 10:21 PM
>To: ncl-talk at ucar.edu
>Subject: [ncl-talk] plotting model output where x/y are not lat/lon
>
>Hi all,
>
>I'm trying to make a simple plot of cumulative snowfall with data from a
>model I did not run. When I try to make a simple plot, I receive the
>following error:
>
>(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'
>(0) check_for_lon_coord: Warning: Data either does not contain a valid
>longitude coordinate array or doesn't contain one at all.
>(0) A valid longitude coordinate array should have a 'units' attribute
>equal to one of the following values:
>(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
>'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
>
>
>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
>When I dump the file it looks like this:
>
>
>
>netcdf ICE.1983.01-12.f77 {
>dimensions:
> TIME = UNLIMITED ; // (365 currently)
> X10_69 = 60 ;
> Y18_127 = 110 ;
> SECTOR = 2 ;
> SECTOR1_1 = 1 ;
> ATMLAY14_23 = 10 ;
> bnds = 2 ;
> ATMLAY23_23 = 1 ;
> ATM6H3_3 = 1 ;
> OUTLAY = 20 ;
> OUTLAY1_1 = 1 ;
>
>variables:
> double TIME(TIME) ;
> TIME:units = "HOURS since 1901-01-15 00:00:00" ;
> TIME:long_name = "time" ;
> TIME:time_origin = "15-JAN-1901 00:00:00" ;
> TIME:axis = "T" ;
> float DATE(TIME) ;
> DATE:units = "YYYYMMDDHH" ;
> DATE:long_name = "Date(YYYY MM DD HH)" ;
> DATE:history = "From ICE.f77.1983.01.01-15" ;
> double X10_69(X10_69) ;
> X10_69:units = "km" ;
> X10_69:long_name = "x" ;
> X10_69:point_spacing = "even" ;
> X10_69:axis = "X" ;
>
> double Y18_127(Y18_127) ;
> Y18_127:units = "km" ;
> Y18_127:long_name = "y" ;
> Y18_127:point_spacing = "even" ;
> Y18_127:axis = "Y" ;
> float LON(Y18_127, X10_69) ;
> LON:units = "degrees" ;
> LON:long_name = "Longitude" ;
> LON:history = "From ICE.f77.1983.01.01-15" ;
> float LAT(Y18_127, X10_69) ;
> LAT:units = "degrees" ;
> LAT:long_name = "Latitude" ;
> LAT:history = "From ICE.f77.1983.01.01-15" ;
>
>
>Clearly there are lats and lons associated with the x and y spacing, but
>I'm
>not sure how to tell NCL how to use those. Does anyone have advice on
>this?
>
>Thanks in advance,
>Mira
>
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk at ucar.edu
>List instructions, subscriber options, unsubscribe:
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk at ucar.edu
>List instructions, subscriber options, unsubscribe:
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
University of Tasmania Electronic Communications Policy (December, 2014).
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
More information about the ncl-talk
mailing list