• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ArrayDouble类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中ucar.ma2.ArrayDouble的典型用法代码示例。如果您正苦于以下问题:Java ArrayDouble类的具体用法?Java ArrayDouble怎么用?Java ArrayDouble使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayDouble类属于ucar.ma2包,在下文中一共展示了ArrayDouble类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addConcatenatedValueArraysToMaps

import ucar.ma2.ArrayDouble; //导入依赖的package包/类
private static void addConcatenatedValueArraysToMaps(Map<Variable, Array> variableArraysMap, Map<Variable, Array> timeVariableArraysMap, Variable targetVariable, Variable timeVariableTarget, boolean concatenateTimeVariable, int targetLocationDimensionLength, double[][] targetValues, double[][] addedValues, double[] timesTarget, double[] convertedTimesToBeAdded, int totalTimesCombined, boolean firstAddedTimeOverlapping) {
	if (firstAddedTimeOverlapping) totalTimesCombined--;
	ArrayDouble.D1 timeArrayDouble = new ArrayDouble.D1(totalTimesCombined);
	ArrayDouble.D2 valueArrayDouble = new ArrayDouble.D2(totalTimesCombined, targetLocationDimensionLength);

	int targetTimes = firstAddedTimeOverlapping ? timesTarget.length - 1 : timesTarget.length;
	for (int i = 0; i < targetTimes; i++) {
		if (concatenateTimeVariable) timeArrayDouble.set(i, timesTarget[i]);
		for (int j = 0; j < targetLocationDimensionLength; j++) {
			valueArrayDouble.set(i, j, targetValues[i][j]);
		}
	}
	for (int i = 0; i < convertedTimesToBeAdded.length; i++) {
		if (concatenateTimeVariable) timeArrayDouble.set(i + targetTimes, convertedTimesToBeAdded[i]);
		for (int j = 0; j < targetLocationDimensionLength; j++) {
			valueArrayDouble.set(i + targetTimes, j, addedValues[i][j]);
		}
	}
	if (concatenateTimeVariable) timeVariableArraysMap.put(timeVariableTarget, timeArrayDouble);
	variableArraysMap.put(targetVariable, valueArrayDouble);
}
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:22,代码来源:NetcdfFileConcatenater.java


示例2: writeEmpty

import ucar.ma2.ArrayDouble; //导入依赖的package包/类
public void writeEmpty (String netcdfFilename) throws Exception {
    ArrayList<Dimension> dimList = new ArrayList<Dimension>();
    IntermediateNetcdfFile nfile;
    try {
        nfile = new IntermediateNetcdfFile(netcdfFilename, false);
    } catch (LASException e) {
        throw new Exception("Cannot create empty file.");
    }
    NetcdfFileWriteable netcdfFile = nfile.getNetcdfFile();
    Dimension index = netcdfFile.addDimension("index", 1);
    dimList.add(index);
    netcdfFile.addVariable(time, DataType.DOUBLE, dimList);
    ArrayDouble.D1 data = new ArrayDouble.D1(1);
    Double d = new Double("-9999.");
    data.set(0, d);
    netcdfFile.addGlobalAttribute("query_result", "No data found to match this request.");
    netcdfFile.create();
    netcdfFile.write(time, data);
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:20,代码来源:TabledapTool.java


示例3: normalizeLongitudeData

import ucar.ma2.ArrayDouble; //导入依赖的package包/类
/**
 * Puts longitude into the range [center +/- 180] deg. Center correspond to the class attribute
 *
 * @param data data to normalize
 * @param variable the variable
 * @throws MotuNotImplementedException the motu not implemented exception {@link #longitudeCenter}
 */
protected void normalizeLongitudeData(Array data, Variable variable) throws MotuNotImplementedException {
    if (data instanceof ArrayDouble) {
        normalizeLongitudeData((ArrayDouble) data, variable);
    } else if (data instanceof ArrayFloat) {
        normalizeLongitudeData((ArrayFloat) data, variable);
    } else if (data instanceof ArrayShort) {
        normalizeLongitudeData((ArrayShort) data, variable);
    } else if (data instanceof ArrayInt) {
        normalizeLongitudeData((ArrayInt) data, variable);
    } else if (data instanceof ArrayLong) {
        normalizeLongitudeData((ArrayLong) data, variable);
    } else {
        throw new MotuNotImplementedException(
                String.format("Error in NetcdfWriter normalizeLongitudeData - Array type %s is not implemented", data.getClass().getName()));

    }

}
 
开发者ID:clstoulouse,项目名称:motu,代码行数:26,代码来源:NetCdfWriter.java


示例4: verifyAxisIsMonotonic

import ucar.ma2.ArrayDouble; //导入依赖的package包/类
private void verifyAxisIsMonotonic(CoordinateAxis axis) throws IOException{
    Array array = axis.read();
    if (array instanceof ArrayDouble) {
        ArrayDouble arrayDouble = (ArrayDouble) array;
        Double prevVal = null;
        int direction = 0;
        while (arrayDouble.hasNext()){
            double val = arrayDouble.nextDouble();
            if (prevVal != null) {
                if (direction == 0) {
                    if (prevVal < val) {
                        direction = 1;
                    } else {
                        direction = -1;
                    }
                }
                if (direction == 1) {
                    assertThat(val, greaterThan(prevVal));
                } else {
                    assertThat(val, lessThan(prevVal));                        
                }
            }
            prevVal = val;
        }
    }
}
 
开发者ID:ioos,项目名称:i52n-sos,代码行数:27,代码来源:AbstractIoosNetcdfEncoderTest.java


示例5: factory

import ucar.ma2.ArrayDouble; //导入依赖的package包/类
private static ArrayDouble factory(final double number) {
    ArrayDouble.D0 array = new ArrayDouble.D0();
    array.set(number);
    return array;
}
 
开发者ID:CSU-RADAR-GROUP,项目名称:VCHILL,代码行数:6,代码来源:CreateCASANetCDFFile.java


示例6: testCurviLinearCoords

import ucar.ma2.ArrayDouble; //导入依赖的package包/类
/**
 * Test {@link CurvilinearCoords}.
 * 
 * @throws IOException
 *             if there is a problem when read data in the netCDf file
 * @throws VariableNotFoundException 
 * */

@Test
public void testCurviLinearCoords() throws IOException, VariableNotFoundException {
    Variable varLonRho = cdf.findVariable("lon_rho");
    Variable varLatRho = cdf.findVariable("lat_rho");

    ArrayDouble longitudeData = (ArrayDouble) varLonRho.read();
    ArrayDouble latitudeData = (ArrayDouble) varLatRho.read();

    ValuesArray2D longitudeValuesInEDALFormat = new ValuesArray2D(xiSize, etaSize);
    ValuesArray2D latitudeValuesInEDALFormat = new ValuesArray2D(xiSize, etaSize);
    for (int i = 0; i < longitudeData.getSize(); i++) {
        int m = i % etaSize;
        int n = i / etaSize;
        int[] coords = new int[] { n, m };
        longitudeValuesInEDALFormat.set(longitudeData.getDouble(i), coords);
        latitudeValuesInEDALFormat.set(latitudeData.getDouble(i), coords);
    }

    CurvilinearCoords cCoords = new CurvilinearCoords(longitudeValuesInEDALFormat,
            latitudeValuesInEDALFormat);

    BoundingBox expectedBbox = dataset.getVariableMetadata("allx_u").getHorizontalDomain()
            .getBoundingBox();

    assertEquals(expectedBbox, cCoords.getBoundingBox());
    assertEquals(etaSize, cCoords.getNi());
    assertEquals(xiSize, cCoords.getNj());

    // pick up a horizontal position with id=15000

    int index = 15000;
    HorizontalPosition expectedPos = new HorizontalPosition(longitudeData.getDouble(index),
            latitudeData.getDouble(index));
    int cCoords_i = index % etaSize;
    int cCoords_j = index / etaSize;

    /*
     * CurvilinearCoords use "float" to save coordinates but LatLonPosition
     * use double. This makes a little difficulty for testing. We have to
     * compare them side by side.
     */

    assertEquals(expectedPos.getX(), cCoords.getMidpoint(cCoords_i, cCoords_j).getX(), delta);
    assertEquals(expectedPos.getY(), cCoords.getMidpoint(cCoords_i, cCoords_j).getY(), delta);
    assertEquals(expectedPos.getCoordinateReferenceSystem(),
            cCoords.getMidpoint(cCoords_i, cCoords_j).getCoordinateReferenceSystem());

    List<Cell> cellList = cCoords.getCells();
    Cell cell = cCoords.getCell(cCoords_i, cCoords_j);
    assertEquals(cellList.get(index), cell);

    assertEquals(cCoords_i, cell.getI());
    assertEquals(cCoords_j, cell.getJ());
    assertEquals(expectedPos.getX(), cell.getCentre().getX(), delta);
    assertEquals(expectedPos.getY(), cell.getCentre().getY(), delta);
    assertEquals(expectedPos.getCoordinateReferenceSystem(), cell.getCentre()
            .getCoordinateReferenceSystem());
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:67,代码来源:CurvilinearGridDatasetTest.java



注:本文中的ucar.ma2.ArrayDouble类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FormNode类代码示例发布时间:2022-05-22
下一篇:
Java EntityAnnotation类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap