Package ucar.nc2.dataset

Examples of ucar.nc2.dataset.CoordinateAxis$AxisComparator


    if (positive != null) {
      v.addAttribute(new Attribute("positive", positive));
    }

    if (units != null) {
      AxisType axisType;
      if (SimpleUnit.isCompatible("millibar", units)) {
        axisType = AxisType.Pressure;
      } else if (SimpleUnit.isCompatible("m", units)) {
        axisType = AxisType.Height;
      } else {
        axisType = AxisType.GeoZ;
      }

      if (lookup instanceof Grib2GridTableLookup || lookup instanceof Grib1GridTableLookup) {
        v.addAttribute(new Attribute("GRIB_level_type", Integer.toString(typicalRecord.getLevelType1())));
      } else {
        v.addAttribute(new Attribute("level_type", Integer.toString(typicalRecord.getLevelType1())));
      }
      v.addAttribute(new Attribute(_Coordinate.AxisType, axisType.toString()));
    }

    if (coordValues == null) {
      coordValues = new double[levels.size()];
      for (int i = 0; i < levels.size(); i++) {
View Full Code Here


      HashMap<AxisType, VarProcess> map = new HashMap<AxisType, VarProcess>();

      // find existing axes, so we dont duplicate
      for (VarProcess vp : varList) {
        if (vp.isCoordinateAxis) {
          AxisType atype = getAxisType(ds, (VariableEnhanced) vp.v);
          if (atype != null)
            map.put(atype, vp);
        }
      }

      // look for time axes based on units
      if (map.get(AxisType.Time) == null) {
        for (VarProcess vp : varList) {
          Variable ncvar = vp.v;
          if (!(ncvar instanceof VariableDS)) continue; // cant be a structure
          String unit = ncvar.getUnitsString();

          if (SimpleUnit.isDateUnit(unit)) {
            vp.isCoordinateAxis = true;
            map.put(AxisType.Time, vp);
            parseInfo.format(" Time Coordinate Axis added (unit) = %s from unit %s\n", vp.v.getFullName(), unit);
            //break; // allow multiple time coords
          }
        }
      }

      // look for missing axes by using name hueristics
      for (VarProcess vp : varList) {
        if (vp.isCoordinateVariable) continue;
        Variable ncvar = vp.v;
        if (!(ncvar instanceof VariableDS)) continue; // cant be a structure

        AxisType atype = getAxisType(ds, (VariableEnhanced) vp.v);
        if (atype != null) {
          if (map.get(atype) == null) {
            vp.isCoordinateAxis = true;
            parseInfo.format(" Coordinate Axis added (Default forced) = %s for axis %s\n", vp.v.getFullName(), atype);
            map.put(atype, vp);
View Full Code Here

      }
      super.makeCoordinateTransforms(ds);
    }

    protected AxisType getAxisType(NetcdfDataset ds, VariableEnhanced ve) {
      AxisType result = getAxisTypeCoards(ds, ve);
      if (result != null) return result;

      Variable v = (Variable) ve;
      String vname = v.getShortName();
      String unit = v.getUnitsString();
View Full Code Here

    if (positive != null) {
      v.addAttribute(new Attribute("positive", positive));
    }

    if (units != null) {
      AxisType axisType;
      if (SimpleUnit.isCompatible("millibar", units)) {
        axisType = AxisType.Pressure;
      } else if (SimpleUnit.isCompatible("m", units)) {
        axisType = AxisType.Height;
      } else {
        axisType = AxisType.GeoZ;
      }

      v.addAttribute(
              new Attribute(
                      "grid_level_type",
                      Integer.toString(record.getLevelType1())));

      v.addAttribute(new Attribute(_Coordinate.AxisType,
              axisType.toString()));
      v.addAttribute(new Attribute(_Coordinate.Axes, dims));
      if (!hcs.isLatLon()) {
        v.addAttribute(new Attribute(_Coordinate.Transforms,
                hcs.getGridName()));
      }
View Full Code Here

  private static void mergeOverwriteDataType( ThreddsMetadataBuilder first,
                                              ThreddsMetadataBuilder second,
                                              ThreddsMetadataBuilder mergedThreddsMetadata )
  {
    FeatureType dataType = second.getDataType() != null ? second.getDataType() : first.getDataType();
    if ( dataType != null )
      mergedThreddsMetadata.setDataType( dataType );
  }
View Full Code Here

  public GeoReferencingCoordSys( CoordinateSystem cs) {
    this.cs = cs;
  }

  public double readLatitudeCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException {
    CoordinateAxis axis = cs.getLatAxis();
    if (null == axis) throw new IllegalArgumentException("There is no latitude coordinate");
    return readValue( axis, fromVar, index);
  }
View Full Code Here

    if (null == axis) throw new IllegalArgumentException("There is no latitude coordinate");
    return readValue( axis, fromVar, index);
  }

  public double readLongitudeCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException {
    CoordinateAxis axis = cs.getLonAxis();
    if (null == axis) throw new IllegalArgumentException("There is no longiude coordinate");
    return readValue( axis, fromVar, index);
  }
View Full Code Here

    if (null == axis) throw new IllegalArgumentException("There is no longiude coordinate");
    return readValue( axis, fromVar, index);
  }

  public double readPressureCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException {
    CoordinateAxis axis = cs.getPressureAxis();
    if (null == axis) throw new IllegalArgumentException("There is no pressure coordinate");
    return readValue( axis, fromVar, index);
  }
View Full Code Here

    if (null == axis) throw new IllegalArgumentException("There is no pressure coordinate");
    return readValue( axis, fromVar, index);
  }

  public double readHeightCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException {
    CoordinateAxis axis = cs.getHeightAxis();
    if (null == axis) throw new IllegalArgumentException("There is no height coordinate");
    return readValue( axis, fromVar, index);
  }
View Full Code Here

    if (null == axis) throw new IllegalArgumentException("There is no height coordinate");
    return readValue( axis, fromVar, index);
  }

  public double readTimeCoord(Variable fromVar, int[] index) throws IOException, InvalidRangeException {
    CoordinateAxis axis = cs.getTaxis();
    if (null == axis) throw new IllegalArgumentException("There is no time coordinate");
    return readValue( axis, fromVar, index);
  }
View Full Code Here

TOP

Related Classes of ucar.nc2.dataset.CoordinateAxis$AxisComparator

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.