public void initialize(String dir) throws IOException {
    // Set Time Zone to UTC
    formatUTC.setTimeZone(TimeZone.getTimeZone("UTC"));

    this.dir = dir;
    File f = new File(dir);

    // Ensure the path is a directory
    if (!f.isDirectory()) {
      throw new IllegalArgumentException(f.getName() + " is not a directory.");
    }

    // Filter the list of files

    File[] fa = f.listFiles(new FilenamePatternFilter(".*_[uvw].*\\.nc"));

    if (fa == null) {
      throw new IOException("File list is empty.");
    }

    for (File fil : fa) {

      String name = fil.getName();

      NetcdfFile ncf = NetcdfFile.open(fil.getPath());
      tVar = ncf.findVariable(tName);

      if (tVar == null) {
        System.out.println(
            "WARNING: Time variable "
                + tVar
                + " was not found in "
                + fil.getPath()
                + " when initializing the VelocityReader.  This file will be skipped.");
        continue;
      }

      Array arr = tVar.read();

      // Convert into a java array

      double[] ja = (double[]) arr.copyTo1DJavaArray();

      // Determine the minimum and maximum times

      long[] minmax = new long[2];

      minmax[0] = TimeConvert.HYCOMToMillis((long) ja[0]);
      minmax[1] = TimeConvert.HYCOMToMillis((long) ja[ja.length - 1]);

      // Put into an index linking start time with the associated file

      if (name.lastIndexOf("_u") > 0) {
        if (uFiles.containsKey(minmax[0])) {
          System.out.print(
              "WARNING:  Velocity files have duplicate time keys. "
                  + name
                  + "/"
                  + uFiles.get(minmax[0])
                  + " at "
                  + new Date(minmax[0]));
          System.out.println(" Skipping latter file.");
        } else {
          uFiles.put(minmax[0], ncf);
        }
      }

      if (name.lastIndexOf("_v") > 0) {
        if (vFiles.containsKey(minmax[0])) {
          System.out.print(
              "WARNING:  Velocity files have duplicate time keys. "
                  + name
                  + "/"
                  + vFiles.get(minmax[0])
                  + " at "
                  + new Date(minmax[0]));
          System.out.println(" Skipping latter file.");
        } else {
          vFiles.put(minmax[0], ncf);
        }
      }

      if (name.lastIndexOf("_w") > 0) {
        if (wFiles.containsKey(minmax[0])) {
          System.out.print(
              "WARNING:  Velocity files have duplicate time keys. "
                  + name
                  + "/"
                  + wFiles.get(minmax[0])
                  + " at "
                  + new Date(minmax[0]));
          System.out.println(" Skipping latter file.");
        } else {
          wFiles.put(minmax[0], ncf);
        }
      }
    }

    // If there are no files in one of the index collections, then exit.

    if (uFiles.size() == 0 || vFiles.size() == 0 || wFiles.size() == 0) {
      System.out.println(
          "Velocity directory is empty, or files/variables are not named properly."
              + "Files  must be named as *_u*, *_v*, and *_w*.");

      System.exit(0);
    }

    uKeys = new ArrayList<Long>(uFiles.keySet());
    vKeys = new ArrayList<Long>(vFiles.keySet());
    wKeys = new ArrayList<Long>(wFiles.keySet());

    // Populate uFile, vFile and wFile with the first entry so that they
    // are not null

    uFile = uFiles.get(uKeys.get(0));
    vFile = vFiles.get(vKeys.get(0));
    wFile = wFiles.get(wKeys.get(0));

    uVar = uFile.findVariable(uName);
    vVar = vFile.findVariable(vName);
    wVar = wFile.findVariable(wName);

    // Latitude and depth are read here because they should not change
    // and therefore can be input once only.

    latVar = uFile.findVariable(latName);
    lonVar = uFile.findVariable(lonName);
    zVar = uFile.findVariable(zName);

    setXLookup(lonName);
    setYLookup(latName);
    setZLookup(zName);

    if (positiveDown) {
      zloc.setNegate(true);
    }
    bounds[0][0] = uKeys.get(0);
    NetcdfFile lastfile = uFiles.get(uKeys.get(uKeys.size() - 1));
    Variable t = lastfile.findVariable(tName);
    double last;
    try {
      last = t.read(new int[] {t.getShape(0) - 1}, new int[] {1}).getDouble(0);
      bounds[0][1] = TimeConvert.HYCOMToMillis((long) last);
    } catch (InvalidRangeException e) {
      e.printStackTrace();
    }
  }