[ncl-install] getting started finally

Mary Haley haley at ucar.edu
Mon May 23 08:58:18 MDT 2011


Hi Joe,

The "ncl_ncarg-5.2.1.MacOS_10.6_i386_64bit_nodap_gcc421.tar.gz" file you downloaded contains two major software packages: NCL and NCAR Graphics.

To use NCAR Graphics, one must either write a C or Fortran NCAR Graphics program and compile using a Fortran or C compiler. That's what the "ncargex cpex08" example is doing: copying an NCAR Graphics program to your local directory and trying to compile and execute it.

To use NCL, you don't need to compile anything. NCL is a "scripted" or "interpreted" language like python, which means in order to "run" your NCL script (also called "program"), you run the "ncl" interpreter on it from the UNIX command line. So, for example, if your NCL script that you included below is called "myscript.ncl", then you would run it on the UNIX command line with:

    ncl myscript.ncl

You have the graphical output going to a PS file called "old_out_xy.ps", so if your program finishes successfully, you should end up with a file by that name in your current directory.

For beginner information on using NCL, please see our getting started guide:

http://www.ncl.ucar.edu/get_started.shtml

Good luck,

--Mary

On May 22, 2011, at 5:36 PM, Joseph Cain wrote:

> So far I have failed to comprehend how to get any program going much less how to use NCL, so I thought I would ask a simple question having installed it on my IMac.
> 
> I have tried using your examples like "ncargex cpex08"
> but after flailing around some it says
> The compile and link failed.
> 
> At this time I have for example in my own directory
> 
> [Joe-Mac-1008:~] josephcain% more .cshrc
> setenv NCARG_ROOT /applications/ncl_ncarg-5.2.1.MacOS_10.6_i386_64bit_nodap_gcc421
> setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/applications/ncl_ncarg-5.2.1.MacOS_10.6_i386_64bit_nodap_gcc421/bin
> 
> I recall invoking the test code after the install, which I don't seem to be able to locate again, but it did produce a plot.
> 
> I have the nice test program which Mary Haley wrote for me not long ago which I thought I would use as a test to get started and try to understand some of the constructs.
> 
> It is below, and an extract of the file "old_out" follows.  My questions to help me understand how to get it going include:
> 
> 1. Should the three load lines below be modified in some way ? If so or not, how are they supposed to be used?
> 2. afterwards, how does one compile and execute the code between the begin and end below?  It is not obvious in any of the material I have read.
> 
> 
> 
> 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
> ;---Read 7 columns of data, and ignore first line.
>  data = readAsciiTable("old_out", 7, "float", 1)  
> 
>  year = data(:,0)
>  dlat = data(:,1)
>  dlon = data(:,2)
>  alt  = data(:,3)
>  X    = data(:,4)
>  Y    = data(:,5)
>  Z    = data(:,6)
> 
> ;---Start the graphics.
>  wks   = gsn_open_wks ("ps", "old_out_xy")
> 
> ;---Set some plot options
>  res                              = True
>  res at gsnMaximize                  = True   ; Maximize plot in frame
>  res at gsnDraw                      = False  ; Don't draw plot
>  res at gsnFrame                     = False  ; Don't advance page
> 
>  res at vpWidthF                     = 0.8    ; Change aspect ratio
>  res at vpHeightF                    = 0.2    ; of plot
> 
>  plotx   = gsn_csm_xy(wks, dlat, X, res)
>  ploty   = gsn_csm_xy(wks, dlat, Y, res)
>  plotz   = gsn_csm_xy(wks, dlat, Z, res)
>  plotalt = gsn_csm_xy(wks, dlat, alt, res)
> 
> ;---Panel all three plots on one page as 4 rows, 1 column
>  pres             = True
>  pres at gsnMaximize = True
>  pres at txString    = "Comparison between X, Y, Z, alt"
>  gsn_panel(wks,(/plotx,ploty,plotz,plotalt/),(/4,1/),pres)
> 
> end
> --------------
> 
> [Joe-Mac-1008:projects/mars/plots] josephcain% ls
> old_out			old_out_xy.ncl		old_out_xy.ncl copy
> [Joe-Mac-1008:projects/mars/plots] josephcain% head old_out
>   yr        dlat      dlon      alt         X         Y         Z
> 1999.0396  -77.4576  236.5607  196.1897   37.5075  -70.3262   -8.0432
> 1999.0396  -76.7379  235.7316  191.3689   38.1892  -82.7721    1.8762
> 1999.0396  -76.0140  234.9799  186.6699   37.1596  -92.6662   13.3272
> 1999.0396  -75.2865  234.2944  182.0940   41.3300 -101.3463   25.5609
> 1999.0396  -74.5554  233.6664  177.6428   49.4288 -104.8782   45.9377
> 1999.0396  -73.8211  233.0883  173.3159   60.1135  -99.3531   83.4698
> 1999.0396  -73.0837  232.5538  169.1160   59.3724  -75.3881  143.5756
> 1999.0396  -72.3436  232.0578  165.0432   37.8042  -25.8652  213.3564
> 1999.0396  -71.6007  231.5958  161.0989    7.6971   58.0769  251.1240
> [Joe-Mac-1008:projects/mars/plots] josephcain% tail old_out
> 1999.0396  -26.1934  221.1180  177.4133   72.2601 -154.9218 -123.6529
> 1999.0396  -25.8164  221.0692  179.6584   91.7922 -150.4562 -108.3534
> 1999.0396  -25.4399  221.0206  181.9377  103.3611 -140.1341  -90.3866
> 1999.0396  -25.0639  220.9722  184.2483  125.7770 -131.1891  -57.8323
> 1999.0396  -24.6883  220.9239  186.5920  127.5109 -118.4844  -48.5433
> 1999.0396  -24.3131  220.8758  188.9685  123.6467 -104.1106  -40.9750
> 1999.0396  -23.9385  220.8279  191.3767  126.3278  -94.2096  -36.4291
> 1999.0396  -23.5643  220.7801  193.8179  128.2590  -86.2677  -32.3723
> 1999.0396  -23.1906  220.7325  196.2905  120.9526  -74.2833  -28.5982
> 1999.0396  -22.8174  220.6851  198.7957  115.4841  -67.6852  -22.9296
> [Joe-Mac-1008:projects/mars/plots] josephcain% 
> 



More information about the ncl-install mailing list