[Swift-user] many-to-one mapping

Neil Best nbest at ci.uchicago.edu
Tue Dec 11 14:02:45 CST 2012


On Mon, Dec 10, 2012 at 8:23 PM, Mihael Hategan <hategan at mcs.anl.gov> wrote:
> file foo[] <filesys_mapper; location=@strcat("data/nc/", year, "/"),
> pattern=@strcat("narr-a_221_1_", year, "????_??00_000.single.nc")>;

This is starting to make some sense to me.  Unfortunately the data for
a given year spans 12 monthly directories (data/nc/197901,
data/nc/197902, etc.).  Therefore I would like to be able to say:

foreach year in [1979:2011] {
  file thisYear[]<filesys_mapper;
    location= @strcat( "data/nc/", year, "*"),
    pattern= @strcat( "narr-a_221_", year, "????_??00_000.single.nc")>;
. . .

("*" glob at the end of location) but this does not work, nor do I
expect it to.  I am sure that location is meant to be a literal, not a
glob.  That's why I thought I needed a regex.  Is there a work-around
other than the obvious rearrangement of the data?



More information about the Swift-user mailing list