Codota Logo
CoordinateAxis2D
Code IndexAdd Codota to your IDE (free)

How to use
CoordinateAxis2D
in
ucar.nc2.dataset

Best Java code snippets using ucar.nc2.dataset.CoordinateAxis2D (Showing top 20 results out of 315)

  • Common ways to obtain CoordinateAxis2D
private void myMethod () {
CoordinateAxis2D c =
  • Codota IconGridCoordSystem gridCoordSystem;(CoordinateAxis2D) gridCoordSystem.getYHorizAxis()
  • Codota IconGridCoordSystem gridCoordSystem;(CoordinateAxis2D) gridCoordSystem.getXHorizAxis()
  • Smart code suggestions by Codota
}
origin: org.apache.sis.storage/sis-netcdf

  /**
   * Returns a coordinate for the given two-dimensional grid coordinate axis.
   * This is (indirectly) a callback method for {@link #getAxes()}.
   */
  @Override
  protected double coordinateForAxis(final Object axis, final int j, final int i) {
    return (axis instanceof CoordinateAxis2D) ? ((CoordinateAxis2D) axis).getCoordValue(j, i) : Double.NaN;
  }
}
origin: Unidata/thredds

GeoGridCoordinate2D(CoordinateAxis2D latCoord, CoordinateAxis2D lonCoord) {
 this.latCoord = latCoord;
 this.lonCoord = lonCoord;
 assert latCoord.getRank() == 2;
 assert lonCoord.getRank() == 2;
 int[] shape = latCoord.getShape();
 nrows = shape[0];
 ncols = shape[1];
}
origin: edu.ucar/cdm

@Override
protected Variable copy() {
 return new CoordinateAxis2D(this.ncd, this);
}
origin: Unidata/thredds

/**
 * Only call if isInterval()
 *
 * @return bounds array pr null if not an interval
 */
public ArrayDouble.D3 getCoordBoundsArray() {
 if (coords == null) doRead();
 return makeBoundsFromAux();
}
origin: Unidata/thredds

/**
 * @deprecated use getEdges()
 */
public ArrayDouble.D2 getYEdges() {
 ArrayDouble.D2 mids = getCoordValuesArray();
 return makeEdges(mids);
}
origin: Unidata/thredds

CoordinateAxis2D yAxis  =(CoordinateAxis2D) coordSystem.getYHorizAxis();
int[] xShape = xAxis.getShape();
int[] yShape = yAxis.getShape();
LatLonPoint prev = fromProj.projToLatLon(xAxis.getCoordValue(0, 0), yAxis.getCoordValue(0, 0));
  double x = xAxis.getCoordValue(i, 0);
  double y = yAxis.getCoordValue(i, 0);
  double x = xAxis.getCoordValue(xShape[0]-1, i);
  double y = yAxis.getCoordValue(xShape[0]-1, i);
  double x = xAxis.getCoordValue(i, xShape[1]-1);
  double y = yAxis.getCoordValue(i, xShape[1]-1);
  double x = xAxis.getCoordValue(0, i);
  double y = yAxis.getCoordValue(0, i);
origin: Unidata/thredds

public int findTimeIndexFromCalendarDate(int run_idx, CalendarDate want) throws IOException, InvalidRangeException {
 CoordinateAxisTimeHelper helper = getCoordinateAxisTimeHelper();
 double wantOffset = helper.offsetFromRefDate(want);
 if (isInterval()) {
  ArrayDouble.D3 bounds = getCoordBoundsArray();
  if (bounds == null)
   throw new IllegalStateException("getCoordBoundsArray returned null for coordinate "+getFullName());
  ArrayDouble.D2 boundsForRun = (ArrayDouble.D2) bounds.slice(0,run_idx );
  int idx = findSingleHit(boundsForRun, wantOffset);
  if (idx >= 0) return idx;
  if (idx == -1) return -1;
  // multiple hits = choose closest to the midpoint
  return findClosest(boundsForRun, wantOffset);
 } else {
  ArrayDouble.D2 values = getCoordValuesArray();
  ArrayDouble.D1 valuesForRun = (ArrayDouble.D1) values.slice(0,run_idx );
  for (int i=0; i<valuesForRun.getSize(); i++) {
   if (Misc.nearlyEquals(valuesForRun.get(i), wantOffset))
    return i;
  }
  return -1;
 }
}
origin: edu.ucar/cdm

/**
 * Get the coordinate values as a 1D double array, in canonical order.
 *
 * @return coordinate values
 * @throws UnsupportedOperationException if !isNumeric()
 */
public double[] getCoordValues() {
 if (coords == null) doRead();
 if (!isNumeric())
  throw new UnsupportedOperationException("CoordinateAxis2D.getCoordValues() on non-numeric");
 return (double[]) coords.get1DJavaArray(double.class);
}
origin: Unidata/thredds

private void doRead() {
 Array data;
 try {
  data = read();
  // if (!hasCachedData()) setCachedData(data, false); //cache data for subsequent reading
 } catch (IOException ioe) {
  log.error("Error reading coordinate values " + ioe);
  throw new IllegalStateException(ioe);
 }
 if (data.getRank() != 2)
  throw new IllegalArgumentException("must be 2D");
 if (debug)
  System.out.printf("Coordinate2D read%n");
 coords = (ArrayDouble.D2) Array.factory(DataType.DOUBLE, data.getShape(), data.get1DJavaArray(DataType.DOUBLE));
 if (this.axisType == AxisType.Lon)
  makeConnectedLon(coords);
}
origin: Unidata/thredds

CoordinateAxisTimeHelper helper = tcoord2D.getCoordinateAxisTimeHelper();
if (timeCoord2DBoundsArray == null)
 timeCoord2DBoundsArray = tcoord2D.getCoordBoundsArray();
for (int t = 0; t < timeDim.getLength(); t++) {
 if (isTimeInterval) {
  dtCoords.set("timeDateIntv", timeBoundsDate);
 } else {
  double timeCoord = tcoord2D.getCoordValue(rtIndex, t);
  CalendarDate timeCoordDate = helper.makeCalendarDateFromOffset(timeCoord);
  dtCoords.setTime(timeCoordDate);
origin: Unidata/thredds

if (axis2.isInterval()) {
 ArrayDouble.D3 bounds = axis2.getCoordBoundsArray();
 for (int i = 0; i < axis2.getShape(0); i++)
  for (int j = 0; j < axis2.getShape(1); j++) {
   double start = bounds.get(i, j, 0);
   double end = bounds.get(i, j, 1);
origin: edu.ucar/netcdf

public ArrayDouble.D2 getMidpoints() {
 if (midpoint == null) doRead();
 return midpoint;
}
origin: Unidata/thredds

static void readAllRuntimes(Coverage cover, GridDatatype dt, CoordinateAxis1DTime runtimeAxis, CoordinateAxis1D ensAxis, CoordinateAxis1D vertAxis) {
 GridCoordSystem csys = dt.getCoordinateSystem();
 CoordinateAxis1DTime timeAxis1D = csys.getTimeAxis1D();
 CoordinateAxis timeAxis = csys.getTimeAxis();
 CoordinateAxis2D timeAxis2D = (timeAxis instanceof CoordinateAxis2D) ? (CoordinateAxis2D) timeAxis : null;
 if (runtimeAxis == null)
  readAllTimes1D(cover, dt, null, -1, timeAxis1D, ensAxis, vertAxis);
 else if (timeAxis2D == null) {  // 1D time or no time
  for (int i = 0; i < runtimeAxis.getSize(); i++)
   readAllTimes1D(cover, dt, runtimeAxis.getCalendarDate(i), i, timeAxis1D, ensAxis, vertAxis);
 } else {  // 2D time
  TimeHelper helper = TimeHelper.factory(timeAxis.getUnitsString(), timeAxis.getAttributeContainer());
  if (timeAxis2D.isInterval()) {
   ArrayDouble.D3 bounds = timeAxis2D.getCoordBoundsArray();
   for (int i = 0; i < runtimeAxis.getSize(); i++)
     readAllTimes2D(cover, dt, runtimeAxis.getCalendarDate(i), i, helper, bounds.slice(0, i), ensAxis, vertAxis);
  } else {
   ArrayDouble.D2 coords = timeAxis2D.getCoordValuesArray();
   for (int i = 0; i < runtimeAxis.getSize(); i++)
    readAllTimes2D(cover, dt, runtimeAxis.getCalendarDate(i), i, helper, coords.slice(0, i), ensAxis, vertAxis);
  }
 }
}
origin: edu.ucar/cdm

public ArrayDouble.D2 getXEdges() {
 ArrayDouble.D2 mids = getCoordValuesArray();
 return makeXEdges(mids);
}
origin: edu.ucar/cdm

public ArrayDouble.D2 getYEdges() {
 ArrayDouble.D2 mids = getCoordValuesArray();
 return makeYEdges(mids);
}
origin: edu.ucar/netcdf

public static void main(String[] args) {
 double connect = connectLon(-167.258, 156.55109);
 System.out.printf("%f%n", connect);
 connect = connectLon(connect, 47.010693);
 System.out.printf("%f%n", connect);
}
origin: Unidata/thredds

private boolean detIsPositive(double x0, double y0, double x1, double y1, double x2, double y2) {
 double det = (x1*y2 - y1*x2 -x0*y2 + y0*x2 + x0*y1 - y0*x1);
 if (det == 0)
  log.warn("determinate = 0 on lat/lon=" + latCoord.getFullName() + ", " + latCoord.getFullName()); // LOOK needed?
 return det > 0;
}
origin: edu.ucar/cdm

/**
 * @deprecated use getCoordValuesArray
 */
public ArrayDouble.D2 getMidpoints() {
 return getCoordValuesArray();
}
origin: edu.ucar/netcdf

CoordinateAxis2D yAxis  =(CoordinateAxis2D) coordSystem.getYHorizAxis();
int[] xShape = xAxis.getShape();
int[] yShape = yAxis.getShape();
LatLonPoint prev = fromProj.projToLatLon(xAxis.getCoordValue(0, 0), yAxis.getCoordValue(0, 0));
  double x = xAxis.getCoordValue(i, 0);
  double y = yAxis.getCoordValue(i, 0);
  double x = xAxis.getCoordValue(xShape[0]-1, i);
  double y = yAxis.getCoordValue(xShape[0]-1, i);
  double x = xAxis.getCoordValue(i, xShape[1]-1);
  double y = yAxis.getCoordValue(i, xShape[1]-1);
  double x = xAxis.getCoordValue(0, i);
  double y = yAxis.getCoordValue(0, i);
origin: Unidata/thredds

/**
 * Get the coordinate values as a 1D double array, in canonical order.
 *
 * @return coordinate values
 * @throws UnsupportedOperationException if !isNumeric()
 */
public double[] getCoordValues() {
 if (coords == null) doRead();
 if (!isNumeric())
  throw new UnsupportedOperationException("CoordinateAxis2D.getCoordValues() on non-numeric");
 return (double[]) coords.get1DJavaArray(DataType.DOUBLE);
}
ucar.nc2.datasetCoordinateAxis2D

Javadoc

A 2-dimensional numeric Coordinate Axis. Must be invertible meaning, roughly, that if you draw lines connecting the points, none would cross.

Most used methods

  • getCoordValue
    Get the coordinate value at the i, j index.
  • getShape
  • <init>
    Create a 2D coordinate axis from an existing VariableDS
  • connectLon
  • doRead
  • getCoordValuesArray
  • getFullName
  • getRank
  • isNumeric
  • makeConnectedLon
  • read
  • section
    Create a new CoordinateAxis2D as a section of this CoordinateAxis2D.
  • read,
  • section,
  • computeIsInterval,
  • findAttributeIgnoreCase,
  • getCalendarFromAttribute,
  • getCoordBoundsArray,
  • getCoordinateAxisTimeHelper,
  • getDimension,
  • getParentGroup,
  • getUnitsString

Popular in Java

  • Updating database using SQL prepared statement
  • getExternalFilesDir (Context)
  • getApplicationContext (Context)
  • getContentResolver (Context)
  • InputStreamReader (java.io)
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes
  • PrintWriter (java.io)
    Prints formatted representations of objects to a text-output stream. This class implements all of th
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now