本文整理了Java中ucar.ma2.Index.set0()
方法的一些代码示例,展示了Index.set0()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Index.set0()
方法的具体详情如下:
包路径:ucar.ma2.Index
类名称:Index
方法名:set0
[英]set current element at dimension 0 to v
[中]将维度0处的当前元素设置为v
代码示例来源:origin: Unidata/thredds
public void testString() {
System.out.println("testString: testString");
// read
for (i=0; i<m; i++) {
ima.set0(i);
String val = A.getString( ima);
assert( val.equals("aaa"));
}
}
代码示例来源:origin: uk.ac.ebi.pride.utilities/netCDF-parser
private Map<Float, Float> extractDataPoints(int scanIndex) throws IOException, InvalidRangeException {
// Find the Index of mass and intensity values
Map<Float, Float> dataPoints = new HashMap<Float, Float>();
final int scanStartPosition[] = { ((Long) indexElement.get(scanIndex).getKey()).intValue()};
if(scanIndex == 4975){
System.out.println("wait");}
final int scanLength[] = { ((Long) indexElement.get(scanIndex + 1).getKey()).intValue() - ((Long) indexElement.get(scanIndex).getKey()).intValue() };
final Array massValueArray = massValueVariable.read(scanStartPosition, scanLength);
final Array intensityValueArray = intensityValueVariable .read(scanStartPosition, scanLength);
final Index massValuesIndex = massValueArray.getIndex();
final Index intensityValuesIndex = intensityValueArray.getIndex();
// Get number of data points
final int arrayLength = massValueArray.getShape()[0];
// Load the data points
for (int i = 0; i < arrayLength; i++) {
final Index massIndex0 = massValuesIndex.set0(i);
final Index intensityIndex0 = intensityValuesIndex.set0(i);
dataPoints.put(new Float(massValueArray.getDouble(massIndex0) * massValueScaleFactor), (float) (intensityValueArray
.getDouble(intensityIndex0) * intensityValueScaleFactor));
}
return dataPoints;
}
代码示例来源:origin: edu.ucar/netcdf
/**
* Create a scalar numeric-valued Attribute.
*
* @param name name of Attribute
* @param val value of Attribute
*/
public Attribute(String name, Number val) {
super(name);
int[] shape = new int[1];
shape[0] = 1;
DataType dt = DataType.getType(val.getClass());
Array vala = Array.factory(dt.getPrimitiveClassType(), shape);
Index ima = vala.getIndex();
vala.setDouble(ima.set0(0), val.doubleValue());
setValues(vala);
}
代码示例来源:origin: Unidata/thredds
public Attribute(String name, Number val, boolean isUnsigned) {
super(name);
if (name == null) throw new IllegalArgumentException("Trying to set name to null on " + this);
int[] shape = new int[1];
shape[0] = 1;
DataType dt = DataType.getType(val.getClass(), isUnsigned);
setDataType(dt);
Array vala = Array.factory(dt, shape);
Index ima = vala.getIndex();
vala.setObject(ima.set0(0), val);
setValues(vala);
setImmutable();
}
代码示例来源:origin: Unidata/thredds
public void testStringPutGet() {
System.out.println("testString: testStringPutGet");
// write
ima.set0(0);
A.setString(ima, "hey");
ima.set0(1);
A.setString(ima, "there");
ima.set0(2);
A.setString(ima, "yo");
ima.set0(3);
A.setString(ima, "I");
// read
ima.set0(0);
assert(A.getString(ima).equals("hey"));
ima.set0(1);
assert(A.getString(ima).equals("the"));
ima.set0(2);
assert(A.getString(ima).equals("yo"));
ima.set0(3);
assert(A.getString(ima).equals("I"));
}
代码示例来源:origin: edu.ucar/cdm
public Attribute(String name, Number val, boolean isUnsigned) {
super(name);
if (name == null) throw new IllegalArgumentException("Trying to set name to null on "+this);
int[] shape = new int[1];
shape[0] = 1;
DataType dt = DataType.getType(val.getClass());
Array vala = Array.factory(dt.getPrimitiveClassType(), shape);
Index ima = vala.getIndex();
vala.setDouble(ima.set0(0), val.doubleValue());
setValues(vala);
this.isUnsigned = isUnsigned;
if (isUnsigned) vala.setUnsigned(true);
setImmutable(true);
}
代码示例来源:origin: Unidata/thredds
public void testRegular() {
System.out.println("testString: testRegular");
// read
for (i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
char val = A.getChar(ima);
assert (val == 'a');
}
}
}
代码示例来源:origin: Unidata/thredds
public void setUp() {
// write
for (i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
A.setChar(ima, 'a');
}
}
}
代码示例来源:origin: Unidata/thredds
void transfer(Array slice, int k) {
Index ima = work.getIndex();
ima.set1(k); // this one stays fixed
int count = 0;
IndexIterator ii = slice.getIndexIterator();
while (ii.hasNext()) {
work.setDouble(ima.set0(count), ii.getDoubleNext());
count++;
}
}
代码示例来源:origin: edu.ucar/netcdf4
void transfer(Array slice, int k) {
Index ima = work.getIndex();
ima.set1(k); // this one stays fixed
int count = 0;
IndexIterator ii = slice.getIndexIterator();
while (ii.hasNext()) {
work.setDouble(ima.set0(count), ii.getDoubleNext());
count++;
}
}
代码示例来源:origin: edu.ucar/netcdf
void transfer(Array slice, int k) {
Index ima = work.getIndex();
ima.set1(k); // this one stays fixed
int count = 0;
IndexIterator ii = slice.getIndexIterator();
while (ii.hasNext()) {
work.setDouble(ima.set0(count), ii.getDoubleNext());
count++;
}
}
代码示例来源:origin: Unidata/thredds
public void testGetPut() {
System.out.println("test Set/Get: seti()");
// read
for (i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
for (k=0; k<p; k++) {
double val = A.getDouble(ima.set2(k));
assert (val == i*1000000+j*1000+k);
}
}
}
}
代码示例来源:origin: Unidata/thredds
public void setUp() {
// write
int count = 0;
for (i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
for (k=0; k<p; k++) {
A.setDouble(ima.set2(k), (double) (count++));
}
}
}
}
代码示例来源:origin: Unidata/thredds
public void setUp() {
// write
for (i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
for (k=0; k<p; k++) {
A.setDouble(ima.set2(k), (double) (i*1000000+j*1000+k));
}
}
}
}
代码示例来源:origin: msdk/msdk
final Index massIndex0 = massValuesIndex.set0(i);
代码示例来源:origin: io.github.msdk/msdk-netcdfimport
final Index massIndex0 = massValuesIndex.set0(i);
final Index intensityIndex0 = intensityValuesIndex.set0(i);
mzValues[i] = massValueArray.getDouble(massIndex0)
代码示例来源:origin: edu.ucar/cdm
double val = ii.getDoubleNext();
if (Double.isNaN(val)) continue;
shortData.setDouble(ima.set0(count2), val);
count2++;
代码示例来源:origin: Unidata/thredds
@Before
public void setUp() {
ima = A.getIndex();
// write
for (int i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
for (k=0; k<p; k++) {
ima.set2(k);
A.setDouble(ima, (double) (i*100+j*10+k));
}
}
}
}
代码示例来源:origin: Unidata/thredds
public void setUp() throws InvalidRangeException {
Index ima = A.getIndex();
// write
for (i=0; i<m; i++) {
ima.set0(i);
for (j=0; j<n; j++) {
ima.set1(j);
for (k=0; k<p; k++) {
ima.set2(k);
A.setDouble(ima, (double) (i*100+j*10+k));
}
}
}
// section
secA = (ArrayDouble) A.section( new Section(m1+":"+m2+",:,:").getRanges() );
}
代码示例来源:origin: Unidata/thredds
StructureData sd = (StructureData) data.getObject(ima.set0(29));
assert (sd.getScalarDouble("c_name") == 9.0) : sd.getScalarDouble("c_name");
内容来源于网络,如有侵权,请联系作者删除!