systemfunc returning an integer

From: Joe Grim <grim_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 16 2012 - 13:52:25 MST

Hi,

I am trying to use the systemfunc function in order to check if a
directory exists. The NCL documentation
(http://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml)
says that the returned array should be of type string. However, I keep
getting it of type integer. What I am ultimately trying to do is see if
the directory exists, and if not, create it.

Here is the code snippet:
    dir_check = systemfunc("ls
/d1/fieldData/CoSPA_INIT_CASES/ncf/MCS_grid/20100603/")
    print(dir_check)

And the relevant output:
ls: cannot access /d1/fieldData/CoSPA_INIT_CASES/ncf/MCS_grid/20100603/:
No such file or directory

Variable: dir_check
Type: integer
Total Size: 4 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
Coordinates:
Number Of Attributes: 1
   _FillValue : -2147483647
(0) -2147483647

It looks to me like if it returns an error message, it decides to return
it as an integer with a missing value. Is this the way it should be?
The problem is that I am trying to test for a string.

Thanks for your help.

Joe Grim

-- 
NCAR - RAL
FL2 Rm 2068
(303) 497-8397
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 16 13:52:37 2012

This archive was generated by hypermail 2.1.8 : Fri Feb 17 2012 - 08:50:10 MST