/** * Adjust the mappingName if needed. This may happen for some projections where different * standard parallels may require _1SP or _2SP suffix. * * @param the input netCDF mappingName * @param var the gridMapping variable * @return */ private static String getProjectionName(String mappingName, Variable var) { String projectionName = mappingName; if (mappingName.equalsIgnoreCase(CF.LAMBERT_CONFORMAL_CONIC)) { Attribute standardParallel = var.findAttribute(CF.STANDARD_PARALLEL); // special Management for multiple standard parallels to use // the proper projection projectionName = CF.LAMBERT_CONFORMAL_CONIC + (standardParallel.getLength() == 1 ? "_1SP" : "_2SP"); } else if (mappingName.equalsIgnoreCase(CF.MERCATOR)) { Attribute standardParallel = var.findAttribute(CF.STANDARD_PARALLEL); projectionName = CF.MERCATOR + (standardParallel == null ? "_2SP" : "_1SP"); } return projectionName; }
Attribute attribute = var.findAttribute(netCDFattributeName); if (attribute != null) { final int numValues = attribute.getLength(); if (numValues > 1) {
/** * True if value is an array (getLength() > 1) * * @return if its an array. */ public boolean isArray() { return (getLength() > 1); }
/** * True if value is an array (getLength() > 1) * * @return if its an array. */ public boolean isArray() { return (getLength() > 1); }
/** * True if value is an array (getLength() > 1) * * @return if its an array. */ public boolean isArray() { return (getLength() > 1); }
public void setVocabularyId(Attribute id) { if (id == null) return; StringBuilder sbuff = new StringBuilder(); for (int i = 0; i < id.getLength(); i++) { if (i > 0) sbuff.append(","); sbuff.append(id.getNumericValue(i)); } this.id = sbuff.toString(); }
public void setVocabularyId(Attribute id) { if (id == null) return; StringBuilder sbuff = new StringBuilder(); for (int i = 0; i < id.getLength(); i++) { if (i > 0) sbuff.append(","); sbuff.append(id.getNumericValue(i)); } this.id = sbuff.toString(); }
public void setVocabularyId(Attribute id) { if (id == null) return; StringBuilder sbuff = new StringBuilder(); for (int i = 0; i < id.getLength(); i++) { if (i > 0) sbuff.append(","); sbuff.append(id.getNumericValue(i)); } this.id = sbuff.toString(); }
private int writeStringValues(DataOutputStream stream, Attribute att) throws IOException { int n = att.getLength(); if (n == 1) return writeString(stream, att.getStringValue()); else { StringBuilder values = new StringBuilder(); for (int i = 0; i < n; i++) values.append(att.getStringValue(i)); return writeString(stream, values.toString()); } }
private void writeStringValues(Attribute att) throws IOException { int n = att.getLength(); if (n == 1) writeString(att.getStringValue()); else { StringBuilder values = new StringBuilder(); for (int i = 0; i < n; i++) values.append(att.getStringValue(i)); writeString(values.toString()); } }
private int writeStringValues(DataOutputStream stream, Attribute att) throws IOException { int n = att.getLength(); if (n == 1) return writeString(stream, att.getStringValue()); else { StringBuilder values = new StringBuilder(); for (int i = 0; i < n; i++) values.append(att.getStringValue(i)); return writeString(stream, values.toString()); } }
private void writeStringValues(Attribute att) throws IOException { int n = att.getLength(); if (n == 1) writeString(att.getStringValue()); else { StringBuilder values = new StringBuilder(); for (int i = 0; i < n; i++) values.append(att.getStringValue(i)); writeString(values.toString()); } }
private void writeStringValues(Attribute att) throws IOException { int n = att.getLength(); if (n == 1) writeString(att.getStringValue()); else { StringBuilder values = new StringBuilder(); for (int i = 0; i < n; i++) values.append(att.getStringValue(i)); writeString(values.toString()); } }
private int writeStringValues(DataOutputStream stream, Attribute att) throws IOException { int n = att.getLength(); if (n == 1) return writeString(stream, att.getStringValue()); else { StringBuilder values = new StringBuilder(); for (int i = 0; i < n; i++) values.append(att.getStringValue(i)); return writeString(stream, values.toString()); } }
public void testReturnTrue_AllAttributesHaveTheSameSize() { when(a1.getLength()).thenReturn(4); when(a2.getLength()).thenReturn(4); when(a3.getLength()).thenReturn(4); when(a4.getLength()).thenReturn(4); final Attribute[] attributes = {a1, a2, a3, a4}; assertEquals(true, BeamImageInfoPart.allAttributesAreNotNullAndHaveTheSameSize(attributes)); }
public void testReturnFalse_TheAttributesHaveDiffenentSizes() { when(a1.getLength()).thenReturn(4); when(a2.getLength()).thenReturn(4); when(a3.getLength()).thenReturn(3); when(a4.getLength()).thenReturn(4); final Attribute[] attributes = {a1, a2, a3, a4}; assertEquals(false, BeamImageInfoPart.allAttributesAreNotNullAndHaveTheSameSize(attributes)); } }
public void testReturnFalse_FirstAttributeIsNull() { when(a2.getLength()).thenReturn(4); when(a3.getLength()).thenReturn(4); when(a4.getLength()).thenReturn(4); final Attribute[] attributes = {null, a2, a3, a4}; assertEquals(false, BeamImageInfoPart.allAttributesAreNotNullAndHaveTheSameSize(attributes)); }
protected Attribute getChunkAttribute(Variable v) { Attribute att = v.findAttribute(CDM.CHUNK_SIZES); if (att != null && att.getDataType().isIntegral() && att.getLength() == v.getRank()) return att; return null; }
protected Attribute getChunkAttribute(Variable v) { Attribute att = v.findAttribute(CDM.CHUNK_SIZES); if (att != null && att.getDataType().isIntegral() && att.getLength() == v.getRank()) return att; return null; }
@Override public long[] computeChunking(Variable v) { // use CHUNK_SIZE attribute if it exists Attribute att = v.findAttribute(CDM.CHUNK_SIZE); if (att != null && att.getDataType().isIntegral() && att.getLength() == v.getRank()) { long[] result = new long[v.getRank()]; for (int i = 0; i < v.getRank(); i++) result[i] = att.getNumericValue(i).longValue(); return result; } return super.computeChunking(v); } }