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

How to use
CoordinateTransform
in
ucar.nc2.dataset

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

  • Common ways to obtain CoordinateTransform
private void myMethod () {
CoordinateTransform c =
  • Codota IconString str;String str2;ProjectionImpl proj;new ProjectionCT(str, str2, proj)
  • Codota IconCOARDSConvention cOARDSConvention;cOARDSConvention.makeCoordinateTransform(ds, ctv)
  • Codota IconList list;(CoordinateTransform) list.get(location)
  • Smart code suggestions by Codota
}
origin: Unidata/thredds

private static CoverageTransform makeTransform(ucar.nc2.dataset.CoordinateTransform dt) {
 AttributeContainerHelper atts = new AttributeContainerHelper(dt.getName());
 for (Parameter p : dt.getParameters())
  atts.addAttribute(new Attribute(p));
 return new CoverageTransform(dt.getName(), atts, dt.getTransformType() == TransformType.Projection);
}
origin: edu.ucar/netcdf

/**
 * Instances which have same name, authority and parameters are equal.
 */
public boolean equals(Object oo) {
 if (this == oo) return true;
 if (!(oo instanceof CoordinateTransform)) return false;
 CoordinateTransform o = (CoordinateTransform) oo;
 if (!getName().equals(o.getName())) return false;
 if (!getAuthority().equals(o.getAuthority())) return false;
 if (!(getTransformType() == o.getTransformType())) return false;
 List<Parameter> oparams = o.getParameters();
 if (params.size() != oparams.size()) return false;
 for (int i = 0; i < params.size(); i++) {
  Parameter att =  params.get(i);
  Parameter oatt = oparams.get(i);
  if (!att.getName().equals(oatt.getName())) return false;
  //if (!att.getValue().equals(oatt.getValue())) return false;
 }
 return true;
}
origin: edu.ucar/cdm

/**
 * Override Object.hashCode() to be consistent with equals.
 */
public int hashCode() {
 if (hashCode == 0) {
  int result = 17;
  result = 37 * result + getName().hashCode();
  result = 37 * result + getAuthority().hashCode();
  result = 37 * result + getTransformType().hashCode();
  for (Parameter att : params) {
   result = 37 * result + att.getName().hashCode();
   //result = 37*result + att.getValue().hashCode();
  }
  hashCode = result;
 }
 return hashCode;
}
origin: Unidata/thredds

@Test
public void testCF() throws IOException {
 try (GridDataset ds = GridDataset.open(TestDir.cdmUnitTestDir + "conventions/cf/twoGridMaps.nc")) {
  GeoGrid grid = ds.findGridByName("altitude");
  GridCoordSystem gcs = grid.getCoordinateSystem();
  assert 1 == gcs.getCoordinateTransforms().size();
  CoordinateTransform ct = gcs.getCoordinateTransforms().get(0);
  assert ct.getTransformType() == TransformType.Projection;
  assert ct.getName().equals("projection_stere");
 }
}
origin: edu.ucar/netcdf

public int compareTo(Object o) {
 CoordinateTransform oct = (CoordinateTransform) o;
 return name.compareTo(oct.getName());
}
origin: edu.ucar/cdm

/**
 * Add a Parameter to a CoordinateTransform.
 * Make sure that the variable exists. If readData is true, read the data and use it as the value of the
 * parameter, otherwise use the variable name as the value of the parameter.
 *
 * @param rs             the CoordinateTransform
 * @param paramName      the parameter name
 * @param ds             dataset
 * @param varNameEscaped escaped variable name
 * @return true if success, false is failed
 */
protected boolean addParameter(CoordinateTransform rs, String paramName, NetcdfFile ds, String varNameEscaped) {
 if (null == (ds.findVariable(varNameEscaped))) {
  if (null != errBuffer)
   errBuffer.format("CoordTransBuilder %s: no Variable named %s%n", getTransformName(), varNameEscaped);
  return false;
 }
 rs.addParameter(new Parameter(paramName, varNameEscaped));
 return true;
}
origin: edu.ucar/netcdf

List<CoordinateTransform> cctt =  grid.getCoordinateSystem().getCoordinateTransforms();
for(CoordinateTransform ct : cctt){
  Parameter param = ct.findParameterIgnoreCase( CF.FORMULA_TERMS );
origin: Unidata/thredds

assert tList != null;
for (CoordinateTransform ct : tList) {
 if (ct.getTransformType() == TransformType.Projection)
  pList.add(ct);
assert ct.getTransformType() == TransformType.Projection;
assert ct instanceof ProjectionCT;
origin: edu.ucar/cdm

Variable v = ncd.findVariable(ct.getName());
if (ct.getTransformType() == TransformType.Projection)
 newV.addAttribute(new Attribute(CF.GRID_MAPPING, v.getFullName()));
origin: edu.ucar/cdm

@Override
public int compareTo(CoordinateTransform oct) {
 return name.compareTo(oct.getName());
}
origin: edu.ucar/netcdf

/**
 * Override Object.hashCode() to be consistent with equals.
 */
public int hashCode() {
 if (hashCode == 0) {
  int result = 17;
  result = 37 * result + getName().hashCode();
  result = 37 * result + getAuthority().hashCode();
  result = 37 * result + getTransformType().hashCode();
  for (Parameter att : params) {
   result = 37 * result + att.getName().hashCode();
   //result = 37*result + att.getValue().hashCode();
  }
  hashCode = result;
 }
 return hashCode;
}
origin: edu.ucar/netcdf

/**
 * Add a Parameter to a CoordinateTransform.
 * Make sure that the variable exists. If readData is true, read the data and use it as the value of the
 * parameter, otherwise use the variable name as the value of the parameter.
 *
 * @param rs             the CoordinateTransform
 * @param paramName      the parameter name
 * @param ds             dataset
 * @param varNameEscaped escaped variable name
 * @return true if success, false is failed
 */
protected boolean addParameter(CoordinateTransform rs, String paramName, NetcdfFile ds, String varNameEscaped) {
 if (null == (ds.findVariable(varNameEscaped))) {
  if (null != errBuffer)
   errBuffer.format("CoordTransBuilder %s: no Variable named %s\n", getTransformName(), varNameEscaped);
  return false;
 }
 rs.addParameter(new Parameter(paramName, varNameEscaped));
 return true;
}
origin: edu.ucar/cdm

List<CoordinateTransform> cctt = grid.getCoordinateSystem().getCoordinateTransforms();
for (CoordinateTransform ct : cctt) {
 Parameter param = ct.findParameterIgnoreCase(CF.FORMULA_TERMS);
origin: Unidata/thredds

 if (ct.getTransformType() == TransformType.Vertical)
  vList.add(ct);
assert ct.getTransformType() == TransformType.Vertical;
assert ct instanceof VerticalCT;
origin: Unidata/thredds

private Element writeCoordTransform(CoordinateTransform ct) {
 Element ctElem = new Element("coordTransform");
 ctElem.setAttribute("name", ct.getName());
 ctElem.setAttribute("transformType", ct.getTransformType().toString());
 List params = ct.getParameters();
 for (int i = 0; i < params.size(); i++) {
  Parameter param = (Parameter) params.get(i);
  Element pElem = new Element("parameter");
  pElem.setAttribute("name", param.getName());
  pElem.setAttribute("value", param.getStringValue());
  ctElem.addContent(pElem);
 }
 return ctElem;
}
origin: edu.ucar/cdm

/**
 * Instances which have same name, authority and parameters are equal.
 */
public boolean equals(Object oo) {
 if (this == oo) return true;
 if (!(oo instanceof CoordinateTransform)) return false;
 CoordinateTransform o = (CoordinateTransform) oo;
 if (!getName().equals(o.getName())) return false;
 if (!getAuthority().equals(o.getAuthority())) return false;
 if (!(getTransformType() == o.getTransformType())) return false;
 List<Parameter> oparams = o.getParameters();
 if (params.size() != oparams.size()) return false;
 for (int i = 0; i < params.size(); i++) {
  Parameter att =  params.get(i);
  Parameter oatt = oparams.get(i);
  if (!att.getName().equals(oatt.getName())) return false;
  //if (!att.getValue().equals(oatt.getValue())) return false;
 }
 return true;
}
origin: edu.ucar/netcdf

Variable v = ncd.findVariable(ct.getName());
if (ct.getTransformType() == TransformType.Projection)
  newV.addAttribute(new Attribute(CF.GRID_MAPPING, v.getFullName()));
origin: Unidata/thredds

@Override
public int compareTo(CoordinateTransform oct) {
 return name.compareTo(oct.getName());
}
origin: Unidata/thredds

/**
 * Override Object.hashCode() to be consistent with equals.
 */
public int hashCode() {
 if (hashCode == 0) {
  int result = 17;
  result = 37 * result + getName().hashCode();
  result = 37 * result + getAuthority().hashCode();
  result = 37 * result + getTransformType().hashCode();
  for (Parameter att : params) {
   result = 37 * result + att.getName().hashCode();
   //result = 37*result + att.getValue().hashCode();
  }
  hashCode = result;
 }
 return hashCode;
}
origin: Unidata/thredds

/**
 * Add a Parameter to a CoordinateTransform.
 * Make sure that the variable exists. If readData is true, read the data and use it as the value of the
 * parameter, otherwise use the variable name as the value of the parameter.
 *
 * @param rs             the CoordinateTransform
 * @param paramName      the parameter name
 * @param ds             dataset
 * @param varNameEscaped escaped variable name
 * @return true if success, false is failed
 */
protected boolean addParameter(CoordinateTransform rs, String paramName, NetcdfFile ds, String varNameEscaped) {
 if (null == (ds.findVariable(varNameEscaped))) {
  if (null != errBuffer)
   errBuffer.format("CoordTransBuilder %s: no Variable named %s%n", getTransformName(), varNameEscaped);
  return false;
 }
 rs.addParameter(new Parameter(paramName, varNameEscaped));
 return true;
}
ucar.nc2.datasetCoordinateTransform

Javadoc

A CoordinateTransform is an abstraction of a function from a CoordinateSystem to a "reference" CoordinateSystem, such as lat, lon.

Most used methods

  • getName
    get the name
  • getTransformType
    get the transform type
  • findParameterIgnoreCase
    Convenience function; look up Parameter by name, ignoring case.
  • getParameters
    get list of ProjectionParameter objects.
  • addParameter
    add a parameter
  • getAuthority
    get the naming authority

Popular in Java

  • Reading from database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • findViewById (Activity)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • StringTokenizer (java.util)
    The string tokenizer class allows an application to break a string into tokens. The tokenization met
  • Option (scala)
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