Examples of CoordinateAxis


Examples of ucar.nc2.dataset.CoordinateAxis

   * @param ds look in this dataset's "Best" coordinate system.
   * @param atype look for this type of CoordinateAxis. takes the first one it finds.
   * @return the found CoordinateAxis' first Dimension, or null if none or scalar
   */
  static public Dimension findDimensionByType(NetcdfDataset ds, AxisType atype) {
    CoordinateAxis axis = findCoordByType(ds, atype);
    if (axis == null) return null;
    if (axis.isScalar()) return null;
    return axis.getDimension(0);
  }
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

    Variable latVar = null, timeVar = null;

    // identify key variables
    List axes = ds.getCoordinateAxes();
    for (int i = 0; i < axes.size(); i++) {
      CoordinateAxis axis = (CoordinateAxis) axes.get(i);
      if (axis.getAxisType() == AxisType.Lat)
        latVar = axis;
      if (axis.getAxisType() == AxisType.Time)
        timeVar = axis;
    }

    // lat, lon are always in the outer; gotta use name to fetch wrapping variable
    Structure outerSequence = getWrappingParent(ds, latVar);
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

    super(ds);

    // identify key variables
    List axes = ds.getCoordinateAxes();
    for (int i = 0; i < axes.size(); i++) {
      CoordinateAxis axis = (CoordinateAxis) axes.get(i);
      if (axis.getAxisType() == AxisType.Lat)
        latVar = axis;
      if (axis.getAxisType() == AxisType.Lon)
        lonVar = axis;
      if (axis.getAxisType() == AxisType.Height)
        altVar = axis;
      if (axis.getAxisType() == AxisType.Time)
        timeVar = axis;
    }

    if (latVar == null) {
      parseInfo.append("Missing latitude variable");
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

    if (var == null) return null;
    return var.getShortName();
  }

  protected CoordinateAxis findZAxisNotStationAlt(NetcdfDataset ds) {
    CoordinateAxis z = CoordSysEvaluator.findCoordByType(ds, AxisType.Height, new CoordSysEvaluator.Predicate() {
      public boolean match(CoordinateAxis axis) {
        Attribute stdName = axis.findAttribute(CF.STANDARD_NAME);
        return ((stdName == null) || !CF.STATION_ALTITUDE.equals(stdName.getStringValue()));
      }
    });
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

  public static void test1() throws IOException {
    String filename = "D:/work/asaScience/EGM200_3.ncml";
    GridDataset gds = GridDataset.open(filename);
    GeoGrid grid = gds.findGridByName("u_wind");
    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis lonAxis = gcs.getXHorizAxis();
    assert lonAxis instanceof CoordinateAxis2D;
    CoordinateAxis latAxis = gcs.getYHorizAxis();
    assert latAxis instanceof CoordinateAxis2D;

    GridCoordinate2D g2d = new GridCoordinate2D((CoordinateAxis2D) latAxis, (CoordinateAxis2D) lonAxis);
    doOne(g2d, 35.0, -6.0);
    doOne(g2d, 34.667302, -5.008376); // FAIL
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

  public static void test2() throws IOException {
    String filename = "C:/data/fmrc/apex_fmrc/Run_20091025_0000.nc";
    GridDataset gds = GridDataset.open(filename);
    GeoGrid grid = gds.findGridByName("temp");
    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis lonAxis = gcs.getXHorizAxis();
    assert lonAxis instanceof CoordinateAxis2D;
    CoordinateAxis latAxis = gcs.getYHorizAxis();
    assert latAxis instanceof CoordinateAxis2D;

    GridCoordinate2D g2d = new GridCoordinate2D((CoordinateAxis2D) latAxis, (CoordinateAxis2D) lonAxis);
    doOne(g2d, 40.166959,-73.954234);
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

  public static void test3() throws IOException {
    String filename = "/data/testdata/cdmUnitTest/fmrc/rtofs/ofs.20091122/ofs_atl.t00z.F024.grb.grib2";
    GridDataset gds = GridDataset.open(filename);
    GeoGrid grid = gds.findGridByName("Sea_Surface_Height_Relative_to_Geoid");
    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis lonAxis = gcs.getXHorizAxis();
    assert lonAxis instanceof CoordinateAxis2D;
    CoordinateAxis latAxis = gcs.getYHorizAxis();
    assert latAxis instanceof CoordinateAxis2D;

    GridCoordinate2D g2d = new GridCoordinate2D((CoordinateAxis2D) latAxis, (CoordinateAxis2D) lonAxis);
    doOne(g2d, -15.554099426977835, -0.7742870290336263);
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

    // count vertical axes
    int countVertCooordAxes = 0;
    List axes = ncd.getCoordinateAxes();
    for (int i = 0; i < axes.size(); i++) {
      CoordinateAxis axis =  (CoordinateAxis) axes.get(i);
      AxisType t = axis.getAxisType();
      if ((t == AxisType.GeoZ) || (t == AxisType.Height) || (t == AxisType.Pressure) )
        countVertCooordAxes++;
    }

    if (showCount) {
      System.out.println(" grids=" + countGrids + ((ngrids < 0) ? " *" : ""));
      System.out.println(" coordSys=" + countCoordSys + ((ncoordSys < 0) ? " *" : ""));
      System.out.println(" coordAxes=" + countCoordAxes + ((ncoordAxes < 0) ? " *" : ""));
      System.out.println(" vertAxes=" + countVertCooordAxes + ((nVertCooordAxes < 0) ? " *" : ""));
    }

    Iterator iter = gridDs.getGridsets().iterator();
    while (iter.hasNext()) {
      GridDataset.Gridset gridset = (GridDataset.Gridset) iter.next();
      gridset.getGeoCoordSystem();
    }

    GridDatatype grid = gridDs.findGridDatatype(gridName);
    assert (grid != null) : "Cant find grid "+gridName;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis1DTime runtime = gcs.getRunTimeAxis();
    assert (runtime != null) : "Cant find runtime for "+gridName;
    CoordinateAxis time = gcs.getTimeAxis();
    assert (time != null) : "Cant find time for "+gridName;
    assert (time.getRank() == 2) : "Time should be 2D "+gridName;

    if (showCount) {
      System.out.println(" runtimes=" + runtime.getSize());
      System.out.println(" ntimes=" +  time.getDimension(1).getLength());
    }

    if (ngrids >= 0)
      assert ngrids == countGrids : "Grids " + ngrids + " != " + countGrids;
    //if (ncoordSys >= 0)
    //  assert ncoordSys == countCoordSys : "CoordSys " + ncoordSys + " != " + countCoordSys;
    if (ncoordAxes >= 0)
      assert ncoordAxes == countCoordAxes : "CoordAxes " + ncoordAxes + " != " + countCoordAxes;
    if (nVertCooordAxes >= 0)
      assert nVertCooordAxes == countVertCooordAxes : "VertAxes" + nVertCooordAxes + " != " + countVertCooordAxes;

    if (nruns >= 0)
      assert runtime.getSize() == nruns : runtime.getSize()+" != "+ nruns;
    if (nruns >= 0)
      assert time.getDimension(0).getLength() == nruns : " nruns should be "+ nruns;
    if (ntimes >= 0)
      assert time.getDimension(1).getLength() == ntimes : " ntimes should be "+ ntimes;

    gridDs.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

    // count vertical axes
    int countVertCooordAxes = 0;
    List axes = ncd.getCoordinateAxes();
    for (int i = 0; i < axes.size(); i++) {
      CoordinateAxis axis =  (CoordinateAxis) axes.get(i);
      AxisType t = axis.getAxisType();
      if ((t == AxisType.GeoZ) || (t == AxisType.Height) || (t == AxisType.Pressure) )
        countVertCooordAxes++;
    }

    if (showCount) {
      System.out.println(" grids=" + countGrids + ((ngrids < 0) ? " *" : ""));
      System.out.println(" coordSys=" + countCoordSys + ((ncoordSys < 0) ? " *" : ""));
      System.out.println(" coordAxes=" + countCoordAxes + ((ncoordAxes < 0) ? " *" : ""));
      System.out.println(" vertAxes=" + countVertCooordAxes + ((nVertCooordAxes < 0) ? " *" : ""));
    }

    Iterator iter = gridDs.getGridsets().iterator();
    while (iter.hasNext()) {
      GridDataset.Gridset gridset = (GridDataset.Gridset) iter.next();
      gridset.getGeoCoordSystem();
    }

    GridDatatype grid = gridDs.findGridDatatype(gridName);
    assert (grid != null) : "Cant find grid "+gridName;

    GridCoordSystem gcs = grid.getCoordinateSystem();
    CoordinateAxis1DTime runtime = gcs.getRunTimeAxis();
    //System.out.println(" has runtime axis=" +  (runtime != null));

    assert (runtime != null) : "Cant find runtime for "+gridName;
    //assert (runtime == null) : "Should not have runtime coord= "+runtime;

    CoordinateAxis time = gcs.getTimeAxis();
    assert (time != null) : "Cant find time for "+gridName;

    if (showCount) {
      System.out.println(" ntimes=" +  time.getDimension(0).getLength());
    }

    if (ngrids >= 0)
      assert ngrids == countGrids : "Grids " + ngrids + " != " + countGrids;
    /* if (ncoordSys >= 0)
      assert ncoordSys == countCoordSys : "CoordSys " + ncoordSys + " != " + countCoordSys;
    if (ncoordAxes >= 0)
      assert ncoordAxes == countCoordAxes : "CoordAxes " + ncoordAxes + " != " + countCoordAxes;
    if (nVertCooordAxes >= 0)
      assert nVertCooordAxes == countVertCooordAxes : "VertAxes" + nVertCooordAxes + " != " + countVertCooordAxes;  */
    if (ntimes >= 0)
      assert time.getDimension(0).getLength() == ntimes : " ntimes should be "+ ntimes+ "instead = "+ time.getDimension(0).getLength();


    gridDs.close();
  }
View Full Code Here

Examples of ucar.nc2.dataset.CoordinateAxis

      else if (csys.getCoordinateAxes().size() > use.getCoordinateAxes().size())
        use = csys;
    }

    if (use == null) return false;
    CoordinateAxis lat = use.getLatAxis();
    CoordinateAxis lon = use.getLonAxis();
    if ((lat != null) && (lat.getSize() <= 1)) return false; // COARDS singletons
    if ((lon != null) && (lon.getSize() <= 1)) return false;

    // hueristics - cant say i like this, multidim point features could eaily violate
    return (use.getRankDomain() > 2) && (use.getRankDomain() <= use.getRankRange());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.