Re: How to plot figures from 0 to 360 degree correctly?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Nov 03 2010 - 07:32:16 MDT

If you want the cyclic point plotted, I think you will have
to add it manually.

    mlon = dimsizes(u&lon)
    LON = new ( mlon+1, typeof(uavg&lon), "No_FillValue")
    LON(0:mlon-1) = (/ uavg&lon /)
    LON(mlon) = LON(mlon-1) + 2.5
    LON!0 = "LON"
    copy_VarAtts(uavg&lon, LON)

    U = new ( mlon+1, typeof(uavg), getFillValue(uavg))
    U(0:mlon-1) = (/ uavg /)
    U(mlon) = U(0)
    U!0 = "LON"
    U&LON = LON
    copy_VarAtts(uavg, U)

    plot = gsn_csm_xy(wks,U&LON,U,resL)

On 11/3/10 7:19 AM, Dennis Shea wrote:
> I meant to add to my response ..
>
> Add the following and the warning message should disappear.
>
> resL@trXMaxF = 360.
>
> ===
> Also, if you have version v5.1.1 or later you could replace
>
> uavg=dim_avg_Wrap(u(lon|:,time|:))
>
> with
>
> uavg=dim_avg_n_Wrap(u, 0)
>
> Good luck
>
>
> On 11/3/10 12:35 AM, lbqnj wrote:
>> Dear all:
>> Recently I've writtern a code to plot a zonal profile of U-velocity
>> along the equator, but there is always a warning such as:
>> get_lon_values: Warning: The range your of longitude values is greater
>> than 360.
>> And the figure is not correct.
>> The code is as following:
>> 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"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>> begin
>> path="~/data/"
>> f0=addfile(path+"uwnd.daily.hc.nc","r")
>> u=f0->uwnd(:,{925},{0},:)
>> uavg=dim_avg_Wrap(u(lon|:,time|:))
>> printVarSummary(uavg)
>> ;***************************************************
>> wks=gsn_open_wks("x11","U along equator")
>> resL=True
>> resL@xyLineThicknesses<mailto:resL@xyLineThicknesses> = 2. ; thicker line
>> resL@tiYAxisString<mailto:resL@tiYAxisString> = "U avg" ; axis string
>> plot = gsn_csm_xy(wks,uavg&lon,uavg,resL)
>> end
>> The data summary is:
>> netcdf uwnd.daily.hc {
>> dimensions:
>> time = 61 ;
>> lev = 17 ;
>> lat = 73 ;
>> lon = 144 ;
>> variables:
>> float uwnd(time, lev, lat, lon) ;
>> uwnd:missing_value = -9.99e+36f ;
>> uwnd:long_name = "U-velocity" ;
>> uwnd:units = "ms^-1" ;
>> uwnd:_FillValue = -9.99e+36f ;
>> float time(time) ;
>> time:long_name = "time" ;
>> time:units = "days since 2100-1-1 0:0" ;
>> int lev(lev) ;
>> lev:long_name = "pressure" ;
>> lev:units = "hPa" ;
>> float lat(lat) ;
>> lat:units = "degrees_north" ;
>> lat:long_name = "Latitude" ;
>> float lon(lon) ;
>> lon:units = "degrees_east" ;
>> lon:long_name = "Longitude" ;
>> }
>> And the longitude is about:
>> Variable: lon (file variable)
>> Type: float
>> Total Size: 576 bytes
>> 144 values
>> Number of Dimensions: 1
>> Dimensions and sizes: [lon | 144]
>> Coordinates:
>> lon: [ 0..357.5]
>> Number Of Attributes: 2
>> units : degrees_east
>> long_name : Longitude
>> The figture is in the attachment, I'd like to know how to plot it
>> correctly. Thanks for your help.
>> 2010-11-03
>> ------------------------------------------------------------------------
>> B. Liu
>> NUIST, Nanjing, PRC
>>
>>
>>
>> _______________________________________________
>> 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 Nov 3 07:32:21 2010

This archive was generated by hypermail 2.1.8 : Mon Nov 08 2010 - 08:08:50 MST