Re: lat/lon coordinates

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Sep 19 2012 - 19:12:11 MDT

   r2d = 57.2957795
   theta&latitude = (/ r2d*theta&latitude /)
   theta&longitude = (/ r2d*theta&longitude /)
   theta&latitude@units = "degrees_north"
   theta&ongitude@units = "degrees_east"

   res@gsnAddCyclic = False ; data not cyclic

   res@mpMinLatF = min(theta&latitude)
   res@mpMaxLatF = max(theta&latitude)
   res@mpMinLonF = min(theta&longitude)
   res@mpMaxLonF = max(theta&longitude)

On 09/19/2012 06:42 PM, Matt Masarik wrote:
> Hi Adam,
>
> Thanks for the reply. I am not getting any error messages.
>
> Below is the output from including the printVarSummary statement.
> (Note that the lat/lon coords are displayed in radians. I am
> actually converting to degrees in my script, but didn't include
> that part in the email).
>
>
> Variable: theta
> Type: double
> Total Size: 2973312 bytes
> 371664 values
> Number of Dimensions: 4
> Dimensions and sizes: [agcm_time | 1] x [sigma | 29] x [latitude | 89]
> x [longitude | 144]
> Coordinates:
> agcm_time: [2751408000..2751408000]
> sigma: [ -1.. 1]
> latitude: [-1.605702911834783..1.466076571675237]
> longitude: [-3.228859116189509..3.010692959690218]
> Number Of Attributes: 3
> units : ?
> long_name : AGCM potential temperature
> selection_category : agcm
>
>
>
>
> On 09/19/2012 03:07 PM, Adam Phillips wrote:
>> Hi Matt,
>> (Welcome to NCL!)
>> It should not matter whether the longitudes go from -180:180 or 0:360;
>> either way should work.
>>
>> Can you put the following in your script:
>> printVarSummary(theta)
>> right before this line:
>>
>> plot = gsn_csm_contour_map(wks,theta(0,0,:,:),res)
>>
>> and send ncl-talk the results? I am curious to see what the coordinate
>> variables look like. Also, are you getting any error messages? Adam
>>
>>
>> Can you do a print
>> On 09/19/2012 03:26 PM, Matt Masarik wrote:
>>> Hello All,
>>>
>>> I am new to learning NCL and am having some trouble producing a plot
>>> from a netCDF file. When I run a script based on a contour example
>>> I get a map and a color bar, but no field contours. I suspect that
>>> the problem is with the coordinates: the longitude runs from
>>> -180 to 180, vs. 0 to 360.
>>>
>>> Would this longitude description cause a problem?
>>> Any suggestions on which method to use to re-grid?
>>>
>>> Thank you, Matt
>>>
>>>
>>> I included the script used below.
>>>
>>> -------------------------------------------------------------------------------------------
>>>
>>> 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
>>>
>>> in = addfile("./AGCM_RESTART39.nc","r")
>>>
>>> lon = in->longitude
>>> lat = in->latitude
>>> sigma = in->sigma
>>> time = in->agcm_time
>>>
>>> theta = in->theta_agcm
>>>
>>> theta!0 = "time"
>>> theta!1 = "sigma"
>>> theta!2 = "lat"
>>> theta!3 = "lon"
>>> theta&lat@units="degrees_north"
>>> theta&lon@units="degrees_east"
>>>
>>> wks = gsn_open_wks("x11","contour_plot")
>>>
>>> res = True
>>> res@cnFillOn = True
>>> res@gsnSpreadColors = True
>>> res@gsnAddCyclic = False
>>>
>>> plot = gsn_csm_contour_map(wks,theta(0,0,:,:),res)
>>>
>>> end
>>>
>>> ----------------------------------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 19 19:12:19 2012

This archive was generated by hypermail 2.1.8 : Fri Sep 21 2012 - 16:22:29 MDT