[Swift-user] many-to-one mapping

Neil Best nbest at ci.uchicago.edu
Fri Dec 7 15:08:50 CST 2012


On Fri, Dec 7, 2012 at 2:35 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:
>
> foreach {
>    string m = @strcat(...);
>    file[] foo <...;..., match = m,...>;
> }
>

Shouldn't m also be an array?

Also, I don't recognize "file[] foo" in your notation.

I tried this:

foreach year in [1979:2011] {
  m[ year] = @strcat( "^data/nc/", year, "../narr-a_221_", year,
"...._..00_000.single.nc$");
  ncList[ year] = @filenames(
    file foo[]<structured_regexp_mapper;
      source= nc1,
      match= m[ year];>);
  annual[ year]= cdo( "-O mergetime", ncList[ year]);
}

It still doesn't like that the mapper is an argument to @filenames(), I guess.

Could not compile SwiftScript source: line 90:10: expecting ')', found 'foo'

I hope it is clear what I am trying to do.  Each member of ncList[]
would be a long string enumerating the input files for the cdo command
and must be different for each year.



More information about the Swift-user mailing list