Re: transect

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 21 Jun 2006 14:03:31 -0600 (MDT)

Specific answers are below.

I suggest that all people "new to NCL" should download the
Mini-Language Reference Manual
        http://www.ncl.ucar.edu/Document/Manuals/
It does not include the descriptions of version a033's
new features.
        
Black and white is ok but color is better.

>_______________________________________________________
>I'm new in NCL language, so I'm having some problems
>to do things that seems to be easy!
>I'm trying to create a transect, following the example
>script that exist in NCL website, but some is going
>wrong with linint2_points(), that
>gives the following error message:
>
>fatal:linint2_points: The rightmost dimensions of fi must be nyi x nxi,
>where nyi and nxi are the lengths of yi and xi respectively
>fatal:Execute: Error occurred at or near line 30 in file transec.ncl
>
>This happens with
>
>trans =
>linint2_points(t_ar&lat_T,t_ar&lon_T,t_ar,True,dist_at_gclon,dist_at_gclat,2)
>
>where
>
>Variable: t_ar
>Type: float
>Total Size: 714816 bytes
> 178704 values
>Number of Dimensions: 3
>Dimensions and sizes: [z_T | 17] x [lat_T | 73] x [lon_T | 144]
>Coordinates:
> lat_T: [90..-90]
> lon_T: [ 0..357.5]
>
>I do not understand this message. I think that is all ok, but I get this
>error message!
>Please, see the entire script below!
>
>Thanks
>Mateus da Silva Teixeira
>
>
>Since that I'm learning NCL, I doing the transect by steps, so the
>script below is only a part of the Transect script present in website.
>The script :
>
>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
> ; Abre arquivo de dados
> arquivo = addfile("./T_Marco2006.nc","r")
> t = arquivo->air(0,:,:,:)
>
> t_ar = t*t_at_scale_factor+t_at_add_offset
> t_ar!0 = "z_T"
> t_ar!1 = "lat_T"
> t_ar!2 = "lon_T"
> t_ar&lat_T = t&lat
> t_ar&lon_T = t&lon
>
> lat1 = -35.
> lon1 = -60.
> lat2 = -25.
> lon2 = -48.
> npts = 100 ; numero de pontos no transect
>
> dist = gc_latlon(lat1,lon1, lat2,lon2, npts,2)
> pts = ispan(0,npts-1,1)*1.0
>
> printVarSummary(t_ar) ; informacoes de t_ar
>
> ; interpola os dados ao "grande circulo"
> trans =
>linint2_points(t_ar&lat_T,t_ar&lon_T,t_ar,True,dist_at_gclon,dist_at_gclat,2)
>end
>_______________________________________________________

Several comments:

[1] Your data are of type short. Replace

> t = arquivo->air(0,:,:,:)
> t_ar = t*t_at_scale_factor+t_at_add_offset
> t_ar!0 = "z_T"
> t_ar!1 = "lat_T"
> t_ar!2 = "lon_T"
> t_ar&lat_T = t&lat
> t_ar&lon_T = t&lon
    
    with
    
    t_ar = short2flt( arquivo->air(0,:,:,:) )
    printVarSummary( t_ar)
    
    The "short2flt" function located in "contributed.ncl"
    is described at:

http://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml

[2] The "linint2_points" function

http://www.ncl.ucar.edu/Document/Functions/Built-in/linint2_points.shtml

    states that both "yi" [latitude] and "xi" [longitude]
    must be "monotonically increasing". Your coordinates are
    
                 lat_T: [90..-90] <== monotonically decreasing
                 lon_T: [ 0..357.5]

    Try the following:
    
    t_ar = t_ar(:,::-1,:) ; make 90S -> 90N
    printVarSummary(t_ar) ; lat_T: [-90..90]
    
[3] The longitudes associated with your data span [ 0..357.5]
    However, you specify lon1=-25 and lon2=-48.
    
    The longitudes must be consistent.
    
    [a] lon1 = 335 ; 360-25.
        lon2 = 312 ; 360-48
        dist = gc_latlon(lat1,lon1, lat2,lon2, npts,2)
       ;print(dist_at_gclon+" "+dist_at_gclat)
       
    [b] trans = linint2_points(t_ar&lat_T, t_ar&lon_T, t_ar, True \
                              ,dist_at_gclon, dist_at_gclat,2)

    [c] or, if you want meta data:
    
        trans = linint2_points_Wrap(t_ar&lat_T, t_ar&lon_T, t_ar, True \
                              ,dist_at_gclon, dist_at_gclat,2)
       
        printVarSummary( trans )
        
Good Luck
D

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jun 21 2006 - 14:03:31 MDT

This archive was generated by hypermail 2.2.0 : Wed Jun 21 2006 - 17:13:25 MDT