Java Code Examples for ucar.nc2.constants.AxisType#Ensemble

The following examples show how to use ucar.nc2.constants.AxisType#Ensemble . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CdmrfReader.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static AxisType convertAxisType(CdmrFeatureProto.AxisType dtype) {
  switch (dtype) {
    case RunTime:
      return AxisType.RunTime;
    case Ensemble:
      return AxisType.Ensemble;
    case Time:
      return AxisType.Time;
    case GeoX:
      return AxisType.GeoX;
    case GeoY:
      return AxisType.GeoY;
    case GeoZ:
      return AxisType.GeoZ;
    case Lat:
      return AxisType.Lat;
    case Lon:
      return AxisType.Lon;
    case Height:
      return AxisType.Height;
    case Pressure:
      return AxisType.Pressure;
    case RadialAzimuth:
      return AxisType.RadialAzimuth;
    case RadialDistance:
      return AxisType.RadialDistance;
    case RadialElevation:
      return AxisType.RadialElevation;
    case Spectral:
      return AxisType.Spectral;
    case TimeOffset:
      return AxisType.TimeOffset;
  }
  throw new IllegalStateException("illegal data type " + dtype);
}
 
Example 2
Source File: CoverageTable.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public CoordSysBean(CoverageCollection coverageDataset, CoverageCoordSys gcs) {
  this.gcs = gcs;

  Formatter buff = new Formatter();
  for (String ct : gcs.getTransformNames())
    buff.format("%s,", ct);
  coordTrans = buff.toString();

  for (CoverageCoordAxis axis : gcs.getAxes()) {
    if (axis.getDependenceType() == CoverageCoordAxis.DependenceType.independent)
      nIndAxis++;

    AxisType axisType = axis.getAxisType();
    if (axisType == null)
      continue;
    if (axisType == AxisType.RunTime)
      runtimeName = axis.getName();
    else if (axisType.isTime())
      timeName = axis.getName();
    else if (axisType == AxisType.Ensemble)
      ensName = axis.getName();
    else if (axisType.isVert())
      vertName = axis.getName();
  }

  for (Coverage cov : coverageDataset.getCoverages()) {
    if (cov.getCoordSys() == gcs)
      nCov++;
  }
}
 
Example 3
Source File: CoordinateSystem.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Constructor.
 * 
 * @param ds the containing dataset
 * @param axes Collection of type CoordinateAxis, must be at least one.
 * @param coordTrans Collection of type CoordinateTransform, may be empty or null.
 * @deprecated Use CoordinateSystem.builder()
 */
@Deprecated
public CoordinateSystem(NetcdfDataset ds, Collection<CoordinateAxis> axes,
    Collection<CoordinateTransform> coordTrans) {
  this.ds = ds;
  this.coordAxes = new ArrayList<>(axes);
  this.name = makeName(coordAxes);

  if (coordTrans != null)
    this.coordTrans = new ArrayList<>(coordTrans);

  for (CoordinateAxis axis : coordAxes) {
    // look for AxisType
    AxisType axisType = axis.getAxisType();
    if (axisType != null) {
      if (axisType == AxisType.GeoX)
        xAxis = lesserRank(xAxis, axis);
      if (axisType == AxisType.GeoY)
        yAxis = lesserRank(yAxis, axis);
      if (axisType == AxisType.GeoZ)
        zAxis = lesserRank(zAxis, axis);
      if (axisType == AxisType.Time)
        tAxis = lesserRank(tAxis, axis);
      if (axisType == AxisType.Lat)
        latAxis = lesserRank(latAxis, axis);
      if (axisType == AxisType.Lon)
        lonAxis = lesserRank(lonAxis, axis);
      if (axisType == AxisType.Height)
        hAxis = lesserRank(hAxis, axis);
      if (axisType == AxisType.Pressure)
        pAxis = lesserRank(pAxis, axis);
      if (axisType == AxisType.Ensemble)
        ensAxis = lesserRank(ensAxis, axis);

      if (axisType == AxisType.RadialAzimuth)
        aziAxis = lesserRank(aziAxis, axis);
      if (axisType == AxisType.RadialDistance)
        radialAxis = lesserRank(radialAxis, axis);
      if (axisType == AxisType.RadialElevation)
        elevAxis = lesserRank(elevAxis, axis);
    }

    // collect dimensions
    List<Dimension> dims = axis.getDimensionsAll();
    domain.addAll(dims);
  }
}
 
Example 4
Source File: CoordinateSystem.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
protected CoordinateSystem(Builder<?> builder, NetcdfDataset ncd, List<CoordinateAxis> axes,
    List<CoordinateTransform> allTransforms) {
  this.ds = ncd;
  this.isImplicit = builder.isImplicit;

  // find referenced coordinate axes
  List<CoordinateAxis> axesList = new ArrayList<>();
  StringTokenizer stoker = new StringTokenizer(builder.coordAxesNames);
  while (stoker.hasMoreTokens()) {
    String vname = stoker.nextToken();
    for (CoordinateAxis a : axes) {
      String aname = a.getFullName();
      if (aname.equals(vname)) {
        axesList.add(a);
      }
    }
  }
  this.coordAxes = axesList;

  // calculated
  this.name = makeName(coordAxes);

  for (CoordinateAxis axis : this.coordAxes) {
    // look for AxisType
    AxisType axisType = axis.getAxisType();
    if (axisType != null) {
      if (axisType == AxisType.GeoX)
        xAxis = lesserRank(xAxis, axis);
      if (axisType == AxisType.GeoY)
        yAxis = lesserRank(yAxis, axis);
      if (axisType == AxisType.GeoZ)
        zAxis = lesserRank(zAxis, axis);
      if (axisType == AxisType.Time)
        tAxis = lesserRank(tAxis, axis);
      if (axisType == AxisType.Lat)
        latAxis = lesserRank(latAxis, axis);
      if (axisType == AxisType.Lon)
        lonAxis = lesserRank(lonAxis, axis);
      if (axisType == AxisType.Height)
        hAxis = lesserRank(hAxis, axis);
      if (axisType == AxisType.Pressure)
        pAxis = lesserRank(pAxis, axis);
      if (axisType == AxisType.Ensemble)
        ensAxis = lesserRank(ensAxis, axis);

      if (axisType == AxisType.RadialAzimuth)
        aziAxis = lesserRank(aziAxis, axis);
      if (axisType == AxisType.RadialDistance)
        radialAxis = lesserRank(radialAxis, axis);
      if (axisType == AxisType.RadialElevation)
        elevAxis = lesserRank(elevAxis, axis);
    }
    // collect dimensions
    List<Dimension> dims = axis.getDimensionsAll();
    domain.addAll(dims);
  }

  // Find the named coordinate transforms in allTransforms.
  for (String wantTransName : builder.transNames) {
    CoordinateTransform got = allTransforms.stream()
        .filter(ct -> (wantTransName.equals(ct.getName())
            || ct.getAttributeContainer() != null && wantTransName.equals(ct.getAttributeContainer().getName())))
        .findFirst().orElse(null);
    if (got != null) {
      coordTrans.add(got);
    }

  }
}