[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to read data in with SPAWN



The result of the:
    let filelist = spawn("ls -1 *CNRM*.nc")
is a string array variable on an X axis, and acts like other data arrays:
   list filelist
will list out all the filenames.  (Note the "-1 flag to "ls" - this puts each filename on a separate line.)  To use this list of filenames:

-- If you want to consider all these dataset as parts of one big dataset, consider the "define data /aggregate" commands.  For this command you can just give it the string array variable ("filelist" in the above example).  You will need to choose the appropriate aggregation options depending on what your data files contain and how you want them aggregated.

-- If you just want to open them as separate datasets, the syntax would be: 
   use `filelist[I=1]` 
to open the first one,
    use `filelist[2]`
to open the second one, etc.

Karl



On Fri, Oct 5, 2018 at 11:39 AM Xiaoyu Bai <xbai1@xxxxxxxx> wrote:
Dear ferreters,

I have several nc files share the same name partially (like *CNRM*.nc). I want to read them all in once. So I used SPAWN:"ls *CNRM*.nc". However, the returns contain double quotation marks like "pr_Amon_CNRM-AM6-DIA-v2_LandControl_r1i1p1_196901-200812.nc" which fails to make use data_file work because it's actually use "data_file". Any suggestions?

Thank you very much.  
--
Xiaoyu


--
Karl M. Smith, Ph.D.
JISAO Univ. Wash. and PMEL NOAA
"The contents of this message are mine personally and do
not necessarily reflect any position of the Government
or the National Oceanic and Atmospheric Administration."

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement