Tabnine Logo
GridCoordSys
Code IndexAdd Tabnine to your IDE (free)

How to use
GridCoordSys
in
ucar.nc2.dt.grid

Best Java code snippets using ucar.nc2.dt.grid.GridCoordSys (Showing top 20 results out of 315)

origin: edu.ucar/cdm

public GridCoordSys getGridCoordSys(VariableEnhanced ve) {
 List<CoordinateSystem> csList = ve.getCoordinateSystems();
 for (CoordinateSystem cs : csList) {
  if (GridCoordSys.isGridCoordSys(null, cs, ve)) {
   return new GridCoordSys(cs, null);
  }
 }
 return null;
}
origin: edu.ucar/netcdf

/**
 * Given a point in x,y coordinate space, find the x,y index in the coordinate system.
 *
 * @deprecated use findXYindexFromCoord
 */
public int[] findXYCoordElement(double x_coord, double y_coord, int[] result) {
 return findXYindexFromCoord(x_coord, y_coord, result);
}
origin: edu.ucar/cdm

@Override
public void setProjectionBoundingBox() {
 // set canonical area
 if (proj != null) {
  proj.setDefaultMapArea(getBoundingBox());  // LOOK too expensive for 2D
 }
}
origin: edu.ucar/netcdf

@Override
public void show(Formatter f, boolean showCoords) {
 f.format("Coordinate System (%s)%n%n", getName());
 if (getRunTimeAxis() != null) {
  f.format("rt=%s (%s)", runTimeAxis.getFullName(), runTimeAxis.getClass().getName());
  if (showCoords) showCoords(runTimeAxis, f);
  f.format("%n");
 if (getEnsembleAxis() != null) {
  f.format("ens=%s (%s)", ensembleAxis.getFullName(), ensembleAxis.getClass().getName());
  if (showCoords) showCoords(ensembleAxis, f);
  f.format("%n");
 if (getTimeAxis() != null) {
  f.format("t=%s (%s)", tAxis.getFullName(), tAxis.getClass().getName());
  if (showCoords) showCoords(tAxis, f);
  f.format("%n");
 if (getVerticalAxis() != null) {
  f.format("z=%s (%s)", vertZaxis.getFullName(), vertZaxis.getClass().getName());
  if (showCoords) showCoords(vertZaxis, f);
  f.format("%n");
 if (getYHorizAxis() != null) {
  f.format("y=%s (%s)", horizYaxis.getFullName(), horizYaxis.getClass().getName());
  if (showCoords) showCoords(horizYaxis, f);
  f.format("%n");
 if (getXHorizAxis() != null) {
origin: edu.ucar/netcdf

CoordinateAxis xaxis = from.getXHorizAxis();
CoordinateAxis yaxis = from.getYHorizAxis();
} else if ((xaxis instanceof CoordinateAxis2D) && (yaxis instanceof CoordinateAxis2D) && from.isLatLon()) {
 CoordinateAxis2D lon_axis = (CoordinateAxis2D) xaxis;
 CoordinateAxis2D lat_axis = (CoordinateAxis2D) yaxis;
if (from.isGeoXY()) {
 xAxis = horizXaxis;
 yAxis = horizYaxis;
ProjectionImpl projOrig = from.getProjection();
if (projOrig != null) {
 proj = projOrig.constructCopy();
 proj.setDefaultMapArea(getBoundingBox()); // LOOK expensive for 2D
CoordinateAxis1D zaxis = from.getVerticalAxis();
if (zaxis != null) {
 vertZaxis = (z_range == null) ? zaxis : zaxis.section(z_range);
if (from.getVerticalCT() != null) {
 VerticalTransform vtFrom = from.getVerticalTransform(); // LOOK may need to make sure this exists?
 if (vtFrom != null)
  vt = vtFrom.subset(t_range, z_range, y_range, x_range);
 vCT = from.getVerticalCT();
CoordinateAxis1D eaxis = from.getEnsembleAxis();
if (eaxis != null) {
origin: edu.ucar/netcdf

for (CoordinateSystem cs : csList) {
 Element csElem;
 if (GridCoordSys.isGridCoordSys(null, cs, null)) {
  GridCoordSys gcs = new GridCoordSys(cs, null);
  csElem = new Element("gridCoordSystem");
  csElem.setAttribute("name", cs.getName());
  csElem.setAttribute("horizX", gcs.getXHorizAxis().getFullName());
  csElem.setAttribute("horizY", gcs.getYHorizAxis().getFullName());
  if (gcs.hasVerticalAxis())
   csElem.setAttribute("vertical", gcs.getVerticalAxis().getFullName());
  if (gcs.hasTimeAxis())
   csElem.setAttribute("time", cs.getTaxis().getFullName());
 } else {
   gridElem.setAttribute("udunits", isUdunits(ve.getUnitsString()));
  gridElem.setAttribute("coordSys", gcs.getName());
origin: Unidata/thredds

this.gcs = gcs;
CoordinateAxis xaxis = gcs.getXHorizAxis();
if (xaxis instanceof CoordinateAxis1D) {
 xDimOrgIndex = findDimension(gcs.getXHorizAxis().getDimension(0));
 yDimOrgIndex = findDimension(gcs.getYHorizAxis().getDimension(0));
 yDimOrgIndex = findDimension(gcs.getXHorizAxis().getDimension(0));
 xDimOrgIndex = findDimension(gcs.getXHorizAxis().getDimension(1));
if (gcs.getVerticalAxis() != null) zDimOrgIndex = findDimension(gcs.getVerticalAxis().getDimension(0));
if (gcs.getTimeAxis() != null) {
 if (gcs.getTimeAxis1D() != null)
  tDimOrgIndex = findDimension(gcs.getTimeAxis1D().getDimension(0));
 else
  tDimOrgIndex = findDimension(gcs.getTimeAxis().getDimension(1));
if (gcs.getEnsembleAxis() != null) eDimOrgIndex = findDimension(gcs.getEnsembleAxis().getDimension(0));
if (gcs.getRunTimeAxis() != null) rtDimOrgIndex = findDimension(gcs.getRunTimeAxis().getDimension(0));
origin: Unidata/thredds

 if (!(p instanceof RotatedPole) && !(p instanceof RotatedLatLon)) {
  horizXaxis = convertUnits(horizXaxis);
  horizYaxis = convertUnits(horizYaxis);
if (projOrig != null) {
 proj = projOrig.constructCopy();
 proj.setDefaultMapArea(getBoundingBox());  // LOOK too expensive for 2D
this.name = makeName(coordAxes);
Attribute att = getXHorizAxis().findAttribute(_Coordinate.Stagger);
if (att != null)
 setHorizStaggerType(att.getStringValue());
origin: edu.ucar/netcdf

if (isLatLon()) {
 double startLat = horizYaxis.getMinValue();
 double startLon = horizXaxis.getMinValue();
 Projection dataProjection = getProjection();
 ProjectionRect bb = getBoundingBox();
 resultNP = findXYindexFromLatLon(90.0, 0, null);
 if (resultNP[0] != -1 && resultNP[1] != -1)
  includesNorthPole = true;
 boolean includesSouthPole = false;
 int[] resultSP = new int[2];
 resultSP = findXYindexFromLatLon(-90.0, 0, null);
 if (resultSP[0] != -1 && resultSP[1] != -1)
  includesSouthPole = true;
  double lonMin = getMinOrMaxLon(llpt.getLongitude(), ulpt.getLongitude(), true);
  double lonMax = getMinOrMaxLon(lrpt.getLongitude(), urpt.getLongitude(), false);
origin: edu.ucar/cdm

if (isLatLon()) {
 double startLat = horizYaxis.getMinValue();
 double startLon = horizXaxis.getMinValue();
 ProjectionImpl dataProjection = getProjection();
 ProjectionRect bb = getBoundingBox();
 llbb = dataProjection.projToLatLonBB(bb);
origin: edu.ucar/cdm

/**
 * Given a lat,lon point, find the x,y index in the coordinate system.
 *
 * @param lat    latitude position.
 * @param lon    longitude position.
 * @param result put result in here, may be null
 * @return int[2], 0=x,1=y indices in the coordinate system of the point. These will be -1 if out of range.
 */
@Override
public int[] findXYindexFromLatLon(double lat, double lon, int[] result) {
 Projection dataProjection = getProjection();
 ProjectionPoint pp = dataProjection.latLonToProj(new LatLonPointImpl(lat, lon), new ProjectionPointImpl());
 return findXYindexFromCoord(pp.getX(), pp.getY(), result);
}
origin: edu.ucar/cdm

/**
 * Given a lat,lon point, find the x,y index in the coordinate system.
 * If outside the range, the closest point is returned
 *
 * @param lat    latitude position.
 * @param lon    longitude position.
 * @param result put result in here, may be null
 * @return int[2], 0=x,1=y indices in the coordinate system of the point.
 */
@Override
public int[] findXYindexFromLatLonBounded(double lat, double lon, int[] result) {
 Projection dataProjection = getProjection();
 ProjectionPoint pp = dataProjection.latLonToProj(new LatLonPointImpl(lat, lon), new ProjectionPointImpl());
 return findXYindexFromCoordBounded(pp.getX(), pp.getY(), result);
}
origin: Unidata/thredds

/**
 * Get the string name for the ith time coordinate.
 *
 * @param index which time coordinate
 * @return time name.
 * @deprecated
 */
public String getTimeName(int index) {
 List<CalendarDate> cdates = getCalendarDates();
 if ((index < 0) || (index >= cdates.size()))
  throw new IllegalArgumentException("getTimeName illegal index = " + index);
 return cdates.get(index).toString();
}
origin: Unidata/thredds

public GridDatatype makeSubset(Range rt_range, Range e_range, Range t_range, Range z_range, Range y_range, Range x_range) throws InvalidRangeException {
 // get the ranges list
 int rank = getRank();
 Range[] ranges = new Range[rank];
 if (null != getXDimension())
  ranges[xDimOrgIndex] = x_range;
 if (null != getYDimension())
  ranges[yDimOrgIndex] = y_range;
 if (null != getZDimension())
  ranges[zDimOrgIndex] = z_range;
 if (null != getTimeDimension())
  ranges[tDimOrgIndex] = t_range;
 if (null != getRunTimeDimension())
  ranges[rtDimOrgIndex] = rt_range;
 if (null != getEnsembleDimension())
  ranges[eDimOrgIndex] = e_range;
 List<Range> rangesList = Arrays.asList(ranges);
 // subset the variable
 VariableDS v_section = (VariableDS) vs.section( new Section(rangesList));
 List<Dimension> dims = v_section.getDimensions();
 for (Dimension dim : dims) {
  dim.setShared(true); // make them shared (section will make them unshared)
 }
 // subset the axes in the GridCoordSys
 GridCoordSys gcs_section = new GridCoordSys(gcs, rt_range, e_range, t_range, z_range, y_range, x_range);
 // now we can make the geogrid
 return new GeoGrid(dataset, v_section, gcs_section);
}
origin: Unidata/thredds

@Test
@Category(NeedsCdmUnitTest.class)
public void testVerticalAxis() throws Exception {
 String uri = TestDir.cdmUnitTestDir + "ncml/nc/cg/CG2006158_120000h_usfc.nc";
 String varName = "CGusfc";
 try (GridDataset dataset = GridDataset.open(uri)) {
  GeoGrid grid = dataset.findGridByName(varName);
  assert null != grid;
  GridCoordSystem gcsi = grid.getCoordinateSystem();
  assert null != gcsi;
  assert (gcsi.getVerticalAxis() != null);
  GridCoordSys gcs = (GridCoordSys) grid.getCoordinateSystem();
  assert null != gcs;
  assert gcs.hasVerticalAxis();          // returns true.
  // subset geogrid
  GeoGrid subg = grid.subset(null, null, null, 1, 1, 1);
  assert null != subg;
  GridCoordSystem gcsi2 = subg.getCoordinateSystem();
  assert null != gcsi2;
  assert (gcsi2.getVerticalAxis() != null);
  GridCoordSys gcs2 = (GridCoordSys) subg.getCoordinateSystem();
  assert null != gcs2;
  assert !gcs2.hasVerticalAxis();          // fails
 }
}
origin: Unidata/thredds

CoordinateAxis xaxis = from.getXHorizAxis();
CoordinateAxis yaxis = from.getYHorizAxis();
} else if ((xaxis instanceof CoordinateAxis2D) && (yaxis instanceof CoordinateAxis2D) && from.isLatLon()) {
 CoordinateAxis2D lon_axis = (CoordinateAxis2D) xaxis;
 CoordinateAxis2D lat_axis = (CoordinateAxis2D) yaxis;
if (from.isGeoXY()) {
 xAxis = horizXaxis;
 yAxis = horizYaxis;
ProjectionImpl projOrig = from.getProjection();
if (projOrig != null) {
 proj = projOrig.constructCopy();
 proj.setDefaultMapArea(getBoundingBox()); // LOOK expensive for 2D
CoordinateAxis1D zaxis = from.getVerticalAxis();
if (zaxis != null) {
 vertZaxis = (z_range == null) ? zaxis : zaxis.section(z_range);
if (from.getVerticalCT() != null) {
 VerticalTransform vtFrom = from.getVerticalTransform(); // LOOK may need to make sure this exists?
 if (vtFrom != null)
  vt = vtFrom.subset(t_range, z_range, y_range, x_range);
 vCT = from.getVerticalCT();
CoordinateAxis1D eaxis = from.getEnsembleAxis();
if (eaxis != null) {
origin: Unidata/thredds

for (CoordinateSystem cs : csList) {
 Element csElem;
 if (GridCoordSys.isGridCoordSys(null, cs, null)) {
  GridCoordSys gcs = new GridCoordSys(cs, null);
  csElem = new Element("gridCoordSystem");
  csElem.setAttribute("name", cs.getName());
  csElem.setAttribute("horizX", gcs.getXHorizAxis().getFullName());
  csElem.setAttribute("horizY", gcs.getYHorizAxis().getFullName());
  if (gcs.hasVerticalAxis())
   csElem.setAttribute("vertical", gcs.getVerticalAxis().getFullName());
  if (gcs.hasTimeAxis())
   csElem.setAttribute("time", cs.getTaxis().getFullName());
 } else {
   gridElem.setAttribute("udunits", isUdunits(ve.getUnitsString()));
  gridElem.setAttribute("coordSys", gcs.getName());
origin: Unidata/thredds

@Override
public void show(Formatter f, boolean showCoords) {
 f.format("Coordinate System (%s)%n", getName());
 if (getRunTimeAxis() != null) {
  f.format(" rt=%s (%s)", runTimeAxis.getNameAndDimensions(), runTimeAxis.getClass().getName());
  if (showCoords) showCoords(runTimeAxis, f);
  f.format("%n");
 if (getEnsembleAxis() != null) {
  f.format(" ens=%s (%s)", ensembleAxis.getNameAndDimensions(), ensembleAxis.getClass().getName());
  if (showCoords) showCoords(ensembleAxis, f);
  f.format("%n");
 if (getTimeAxis() != null) {
  f.format(" t=%s (%s)", tAxis.getNameAndDimensions(), tAxis.getClass().getName());
  if (showCoords) showCoords(tAxis, f);
  f.format("%n");
 if (getVerticalAxis() != null) {
  f.format(" z=%s (%s)", vertZaxis.getNameAndDimensions(), vertZaxis.getClass().getName());
  if (showCoords) showCoords(vertZaxis, f);
  f.format("%n");
 if (getYHorizAxis() != null) {
  f.format(" y=%s (%s)", horizYaxis.getNameAndDimensions(), horizYaxis.getClass().getName());
  if (showCoords) showCoords(horizYaxis, f);
  f.format("%n");
 if (getXHorizAxis() != null) {
origin: edu.ucar/cdm

this.gcs = gcs;
CoordinateAxis xaxis = gcs.getXHorizAxis();
if (xaxis instanceof CoordinateAxis1D) {
 xDimOrgIndex = findDimension(gcs.getXHorizAxis().getDimension(0));
 yDimOrgIndex = findDimension(gcs.getYHorizAxis().getDimension(0));
 yDimOrgIndex = findDimension(gcs.getXHorizAxis().getDimension(0));
 xDimOrgIndex = findDimension(gcs.getXHorizAxis().getDimension(1));
if (gcs.getVerticalAxis() != null) zDimOrgIndex = findDimension(gcs.getVerticalAxis().getDimension(0));
if (gcs.getTimeAxis() != null) {
 if (gcs.getTimeAxis1D() != null)
  tDimOrgIndex = findDimension(gcs.getTimeAxis1D().getDimension(0));
 else
  tDimOrgIndex = findDimension(gcs.getTimeAxis().getDimension(1));
if (gcs.getEnsembleAxis() != null) eDimOrgIndex = findDimension(gcs.getEnsembleAxis().getDimension(0));
if (gcs.getRunTimeAxis() != null) rtDimOrgIndex = findDimension(gcs.getRunTimeAxis().getDimension(0));
origin: edu.ucar/netcdf

 if (!(p instanceof RotatedPole) && !(p instanceof RotatedLatLon)) {
  horizXaxis = convertUnits(horizXaxis);
  horizYaxis = convertUnits(horizYaxis);
if (projOrig != null) {
 proj = projOrig.constructCopy();
 proj.setDefaultMapArea(getBoundingBox());  // LOOK too expensive for 2D
this.name = makeName(coordAxes);
Attribute att = getXHorizAxis().findAttribute(_Coordinate.Stagger);
if (att != null)
 setHorizStaggerType(att.getStringValue());
ucar.nc2.dt.gridGridCoordSys

Javadoc

A georeferencing "gridded" CoordinateSystem. This describes a "grid" of coordinates, which implies a connected topology such that values next to each other in index space are next to each other in coordinate space.

This currently assumes that the CoordinateSystem

  1. is georeferencing (has Lat, Lon or GeoX, GeoY axes)
  2. x, y are 1 or 2-dimensional axes.
  3. rt, z, e are 1-dimensional axes.
  4. t is 1 or 2 dimensional. if 2d, then rt exists

This is the common case for georeferencing coordinate systems. Mathematically it is a product set: {X,Y} x {Z} x {T}. The x and y axes may be 1 or 2 dimensional.

A CoordinateSystem may have multiple horizontal and vertical axes. GridCoordSys chooses one axis corresponding to X, Y, Z, and T. It gives preference to one dimensional axes (CoordinateAxis1D).

Most used methods

  • hasVerticalAxis
  • <init>
    Create a GridCoordSys as a section of an existing GridCoordSys. This will create sections of the cor
  • convertUnits
  • findXYindexFromCoord
    Given a point in x,y coordinate space, find the x,y index in the coordinate system.
  • findXYindexFromCoordBounded
    Given a point in x,y coordinate space, find the x,y index in the coordinate system. If outside the r
  • getBoundingBox
    Get the x,y bounding box in projection coordinates.
  • getCalendarDates
  • getCoordinateTransforms
  • getEnsembleAxis
    get the Ensemble axis, else null
  • getHorizStaggerType
  • getLatLon
    Get the Lat/Lon coordinates of the midpoint of a grid cell, using the x,y indices
  • getLatLonBoundingBox
  • getLatLon,
  • getLatLonBoundingBox,
  • getLevels,
  • getMinOrMaxLon,
  • getName,
  • getProjection,
  • getRangesFromLatLonRect,
  • getRunTimeAxis,
  • getTimeAxis,
  • getTimeAxis1D

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • runOnUiThread (Activity)
  • getExternalFilesDir (Context)
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • Runner (org.openjdk.jmh.runner)
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now