Re: Data manipulation

I've attached a small program to show how the different
import strategies work.

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
"There's someone in my head, but it's not me"    Roger Waters
*************************************************************

import visad.*;
import visad.data.netcdf.*;
import visad.data.netcdf.in.*;


/**
 * Class for testing netCDF file import strategies
 */
public class NetcdfTest {

    /**
     * Run with java NetcdfTest  <file>  <strategy>
     *
     * @param args  filename and strategy
     *
     * @throws Exception something went wrong
     */
    public static void main(String[] args) throws Exception {

        if (args.length == 0) {
            System.out.println("must supply a filename");
            System.exit(1);
        }
        int strategy = 0;
        if (args.length > 1) {
            strategy = Integer.parseInt(args[1]);
        }
        switch (strategy) {

          case 0 :
              NetcdfAdapter.setDefaultStrategy(
                  Strategy.MERGED_FILE_FLAT_FIELDS);
              System.out.println("Using MERGED_FILE_FLAT_FIELDS strategy");
              break;

          case 1 :
              NetcdfAdapter.setDefaultStrategy(
                  Strategy.UNMERGED_FILE_FLAT_FIELDS);
              System.out.println("Using UNMERGED_FILE_FLAT_FIELDS strategy");
              break;

          case 2 :
              NetcdfAdapter.setDefaultStrategy(Strategy.IN_MEMORY);
              System.out.println("Using IN_MEMORY strategy");
              break;

          default :
              break;
        }
        InputNetcdf in = new InputNetcdf();
        in.setPathname(args[0]);
        Data  foo   = in.getData();
        System.out.println(foo.getType());
    }
}