Package ucar.nc2.util

Examples of ucar.nc2.util.DiskCache2


      Variable time = ds.findVariable("time_offset");
      if (time != null) {
        Variable base = ds.findVariable("base_time");
        int base_time = base.readScalarInt();
        try {
          DateUnit dunit = new DateUnit("seconds since 1970-01-01 00:00");
          String time_units = "seconds since " + dunit.makeStandardDateString(base_time);
          time.addAttribute(new Attribute("units", time_units));
          time.addAttribute(new Attribute(_Coordinate.AxisType, AxisType.Time.name()));
        } catch (Exception e) {
          e.printStackTrace();
        }
View Full Code Here


    return " ";
  }

private String isUdunits(String unit) {
    try {
      new DateUnit(unit);
      return "date";
    } catch (Exception e) {
      // ok
    }
View Full Code Here

                uStart = description.lastIndexOf("(");
                if (uStart >= 0 && uEnd > uStart) {
                    String possibleUnitName = description.substring(uStart
                                                  + 1, uEnd);
                    try {
                        SimpleUnit u = SimpleUnit.factoryWithExceptions(
                                           possibleUnitName);
                        unitName = possibleUnitName;
                    } catch (Exception e) {
                        unitName = null;
                    }
View Full Code Here

      return "time";
    } catch (Exception e) {
      // ok
    }

    SimpleUnit su = SimpleUnit.factory(unit);
    if (null == su) return "false";
    return su.getCanonicalString();
  }
View Full Code Here

   */
  private double getGridSpacingInKm(String type) {
    double value = gds.getDouble(type);
    if (Double.isNaN(value)) return value;
    String gridUnit = gds.getParam(GridDefRecord.GRID_UNITS);
    SimpleUnit unit = null;

    if (gridUnit == null || gridUnit.length() == 0) {
      unit = SimpleUnit.meterUnit;
    } else {
      unit = SimpleUnit.factory(gridUnit);
    }
    if (unit != null && SimpleUnit.isCompatible(unit.getUnitString(), "km")) {
      value = unit.convertTo(value, SimpleUnit.kmUnit);
    }
    return value;

  }
View Full Code Here

    } catch (Exception e) {
      // ok
    }

    try {
      new TimeUnit(unit);
      return "time";
    } catch (Exception e) {
      // ok
    }
View Full Code Here

    * Create a ForecastModelRun Collection from the datasets in a catalog.
    * @param catURL  scan this catalog
    * @throws Exception on bad
    */
  public static FmrcInventory makeFromCatalog(String catURL, String collectionName, int maxDatasets, int mode) throws Exception {
    DiskCache2 cache =  new DiskCache2("fmrcInventory/", true, 0, -1); // dont scour - messes up the TDS!

    return makeFromCatalog(cache, catURL, collectionName, maxDatasets,  mode);
  }
View Full Code Here

  public TestAggExistingCached( String name) {
    super(name);
  }

  public void setUp() {
    Aggregation.setPersistenceCache( new DiskCache2("/.unidata/cachePersist", true, 60 * 24 * 30, 60));
  }
View Full Code Here

    if (args.length == 1) {
      ForecastModelRunInventory.open(null, args[0], ForecastModelRunInventory.OPEN_FORCE_NEW, true);
      ForecastModelRunInventory.readXML( args[0] +".fmrInv.xml" );
      return;
    }
    DiskCache2 cache =  new DiskCache2("fmrcInventory/", true, 5 * 24 * 3600, 3600);
    String url = "http://motherlode.ucar.edu:9080/thredds/dodsC/fmrc/NCEP/NAM/CONUS_12km/files/NAM_CONUS_12km_20070419_1800.grib2";
    ForecastModelRunInventory fmr = ForecastModelRunInventory.open(cache, url, ForecastModelRunInventory.OPEN_NORMAL, false);
    fmr.writeXML(System.out);
  }
View Full Code Here

  String dataDir = "//zero/share/testdata/image/testSync/";

  public void testTiming() throws IOException, InterruptedException {
    String filename = "file:C:/TEMP/aggManyFiles/TestAggManyFiles.ncml";
    Aggregation.setPersistenceCache( new DiskCache2("/.unidata/cachePersist", true, 60 * 24 * 30, 60));

    long start = System.currentTimeMillis();
    NetcdfFile ncfile = NcMLReader.readNcML(filename, null);
    long ending = System.currentTimeMillis();
    double secs = .001 * (ending - start);
View Full Code Here

TOP

Related Classes of ucar.nc2.util.DiskCache2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.