Re: debug environment for NCL?

From: Sam McClatchie (NOAA Federal) <sam.mcclatchie_at_nyahnyahspammersnyahnyah>
Date: Sun Jun 16 2013 - 10:19:55 MDT

Thanks Yemi -- that works nicely. I add the illegal print statement into
my script following the variables I want to examine, copy the script to
an interactive ncl session to run, which then crashes, but leaves the
variables accessible in the workspace:

; code snippet ********************

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/contrib/calendar_decode2.ncl"
   load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

;************************************************
begin
;************************************************
; read in data
;************************************************
   f=addfile
("../data/PFEL_winds_and_ocean_transports/erdlasFnWPr_4baa_b7bc_5c31.nc","r")
   curl = f->curl(:,0,0)
   time = f->time
   yearfrac = cd_calendar(time, 4)

   print(1/0) ; illegal division
;****************************

************* interactive session in terminal ****************

ncl 36> printVarSummary(yearfrac)

Variable: yearfrac
Type: double
Total Size: 4456 bytes
             557 values
Number of Dimensions: 1
Dimensions and sizes: [557]
Coordinates:
Number Of Attributes: 1
   calendar : standard

ncl 37> print(time)

Variable: time
Type: double
Total Size: 4456 bytes
             557 values
Number of Dimensions: 1
Dimensions and sizes: [time | 557]
Coordinates:
             time: [-93355200..1368792000]
Number Of Attributes: 8
   _CoordinateAxisType : Time
   actual_range : ( -93355200, 1368792000 )
   axis : T
   ioos_category : Time
   long_name : reference time
   standard_name : time
   time_origin : 01-JAN-1970 00:00:00
   units : seconds since 1970-01-01T00:00:00Z
(0) -93355200
(1) -90806400
(2) -88257600
(3) -85622400
(4) -82987200
(5) -80352000
(6) -77716800

ncl 38> print(curl)

Variable: curl
Type: float
Total Size: 2228 bytes
             557 values
Number of Dimensions: 1
Dimensions and sizes: [time | 557]
Coordinates:
             time: [-93355200..1368792000]
Number Of Attributes: 8
   longitude : 242.5
   latitude : 32.5
   _FillValue : -9999
   colorBarMaximum : 3
   colorBarMinimum : -3
   ioos_category : Wind
   long_name : Curl of Surface Wind Stress
   units : MPa m-1
(0) 0.06939734
(1) 0.1011225
(2) -0.09163887
(3) -0.2258962
(4) 0.07263987
(5) -0.02644638

ncl 39>

This will make debugging much more efficient.

Best fishes

Sam

-- 
Sam McClatchie,
Supervisory oceanographer, Fisheries oceanography
Southwest Fisheries Science Center, NOAA,
8901 La Jolla Shores Dr.
La Jolla, CA 92037-1509, U.S.A.
email <Sam.McClatchie@noaa.gov>
Office: 858 546 7083, Cellular:  858 752 8495
Research home page <www.fishocean.info>
                    /\
       ...>><xX(¡>
                 //// \\\\
                    <¡)Xx><<
               /////  \\\\\\
                         ><(((¡>
   >><(((¡>   ...>><xX(¡>O<¡)Xx><<
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jun 16 10:20:18 2013

This archive was generated by hypermail 2.1.8 : Mon Jun 24 2013 - 11:46:47 MDT