本文整理汇总了Java中ucar.nc2.dt.grid.GridCoordSys.getYHorizAxis方法的典型用法代码示例。如果您正苦于以下问题:Java GridCoordSys.getYHorizAxis方法的具体用法?Java GridCoordSys.getYHorizAxis怎么用?Java GridCoordSys.getYHorizAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ucar.nc2.dt.grid.GridCoordSys
的用法示例。
在下文中一共展示了GridCoordSys.getYHorizAxis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRangeValues
import ucar.nc2.dt.grid.GridCoordSys; //导入方法依赖的package包/类
/**
* Gets range values corresponding to range index.
*
* @param gcs grid coordinate system from which range is computed
* @param rangeLat latitude range
* @param rangeLon longitude range
* @param rangeValueLat latitude values corresponding to the range
* @param rangeValueLon longitude values corresponding to the range
*/
private void getRangeValues(GridCoordSys gcs, Range rangeLat, Range rangeLon, double[] rangeValueLat, double[] rangeValueLon)
throws MotuNotImplementedException {
// this is the case where no point are included
boolean hasLatRange = ExtractCriteriaLatLon.hasRange(rangeLat);
boolean hasLonRange = ExtractCriteriaLatLon.hasRange(rangeLon);
CoordinateAxis xaxis = gcs.getXHorizAxis();
CoordinateAxis yaxis = gcs.getYHorizAxis();
if ((xaxis instanceof CoordinateAxis1D) && (yaxis instanceof CoordinateAxis1D)) {
CoordinateAxis1D xaxis1 = (CoordinateAxis1D) xaxis;
CoordinateAxis1D yaxis1 = (CoordinateAxis1D) yaxis;
if ((rangeValueLat != null) && hasLatRange) {
rangeValueLat[0] = yaxis1.getCoordValue(rangeLat.first());
rangeValueLat[1] = yaxis1.getCoordValue(rangeLat.last());
}
if ((rangeValueLon != null) && hasLonRange) {
rangeValueLon[0] = xaxis1.getCoordValue(rangeLon.first());
rangeValueLon[1] = xaxis1.getCoordValue(rangeLon.last());
}
} else if ((xaxis instanceof CoordinateAxis2D) && (yaxis instanceof CoordinateAxis2D) && gcs.isLatLon()) {
CoordinateAxis2D lonAxis = (CoordinateAxis2D) xaxis;
CoordinateAxis2D latAxis = (CoordinateAxis2D) yaxis;
if ((rangeValueLat != null) && hasLatRange) {
rangeValueLat[0] = latAxis.getCoordValue(rangeLat.first(), rangeLon.first());
rangeValueLat[1] = latAxis.getCoordValue(rangeLat.last(), rangeLon.last());
}
if ((rangeValueLon != null) && hasLonRange) {
rangeValueLon[0] = lonAxis.getCoordValue(rangeLat.first(), rangeLon.first());
rangeValueLon[1] = lonAxis.getCoordValue(rangeLat.last(), rangeLon.last());
}
} else {
throw new MotuNotImplementedException(
"Coordinate axes that are not 1D or 2D/LatLon are not implemented in ExtractCriteriaLatLon.toRange");
}
}