_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q175800 | CoordinateAxis.getInfo | test | public void getInfo(Formatter buf) {
buf.format("%-30s", getNameAndDimensions());
buf.format("%-20s", getUnitsString());
if (axisType != null) {
buf.format("%-10s", axisType.toString());
}
buf.format("%s", getDescription());
/* if (isNumeric) {
boolean debugCoords = ucar.util.prefs.ui.Debug.isSet("Dataset/showCoordValues");
int ndigits = debugCoords ? 9 : 4;
for (int i=0; i< getNumElements(); i++) {
buf.append(Format.d(getCoordValue(i), ndigits));
buf.append(" ");
}
if (debugCoords) {
buf.append("\n ");
for (int i=0; i<=getNumElements(); i++) {
buf.append(Format.d(getCoordEdge(i), ndigits));
buf.append(" ");
}
}
} else {
for (int i=0; i< getNumElements(); i++) {
buf.append(getCoordName(i));
buf.append(" ");
}
} */
//buf.append("\n");
} | java | {
"resource": ""
} |
q175801 | CoordinateAxis.getCalendarFromAttribute | test | public ucar.nc2.time.Calendar getCalendarFromAttribute() {
Attribute cal = findAttribute(CF.CALENDAR);
String s = (cal == null) ? null : cal.getStringValue();
if (s == null) { // default for CF and COARDS
Attribute convention = (ncd == null) ? null : ncd.getRootGroup().findAttribute(CDM.CONVENTIONS);
if (convention != null) {
String hasName = convention.getStringValue();
int version = CF1Convention.getVersion(hasName);
if (version >= 0) {
return Calendar.gregorian;
//if (version < 7 ) return Calendar.gregorian;
//if (version >= 7 ) return Calendar.proleptic_gregorian; //
}
if (COARDSConvention.isMine(hasName)) return Calendar.gregorian;
}
}
return ucar.nc2.time.Calendar.get(s);
} | java | {
"resource": ""
} |
q175802 | JTableSorted.setList | test | public void setList ( ArrayList rowList) {
this.list = rowList;
if (list.size() > 0)
jtable.setRowSelectionInterval(0, 0);
else
jtable.clearSelection();
model.sort();
jtable.revalidate();
} | java | {
"resource": ""
} |
q175803 | JTableSorted.getSelected | test | public TableRow getSelected() {
if (list.size() == 0)
return null;
int sel = jtable.getSelectedRow();
if (sel >= 0)
return (TableRow) list.get(sel);
else
return null;
} | java | {
"resource": ""
} |
q175804 | JTableSorted.incrSelected | test | public void incrSelected(boolean increment) {
if (list.size() == 0)
return;
int curr = jtable.getSelectedRow();
if (increment && (curr < list.size()-1))
setSelected(curr+1);
else if (!increment && (curr > 0))
setSelected(curr-1);
} | java | {
"resource": ""
} |
q175805 | JTableSorted.getModelIndex | test | public int[] getModelIndex() {
int [] modelIndex = new int[colName.length];
TableColumnModel tcm = jtable.getColumnModel();
for (int i=0; i<colName.length; i++) {
TableColumn tc = tcm.getColumn(i);
modelIndex[i] = tc.getModelIndex();
}
return modelIndex;
} | java | {
"resource": ""
} |
q175806 | VertScaleSlider.setSelectedIndex | test | private void setSelectedIndex( int idx) {
if (zAxis == null)
return;
eventOK = false;
currentIdx = idx;
slider.setValue( world2slider(zAxis.getCoordValue(currentIdx)));
eventOK = true;
} | java | {
"resource": ""
} |
q175807 | Util.quickSort | test | static private void quickSort(String a[], int lo0, int hi0) {
int lo = lo0;
int hi = hi0;
String mid;
if (hi0 > lo0) {
// Arbitrarily establishing partition element as the array midpoint */
//Coverity[FB.IM_AVERAGE_COMPUTATION_COULD_OVERFLOW]
mid = a[(lo0 + hi0) / 2];
// loop through the array until indices cross
while (lo <= hi) {
// find the first element that is >= the partition element
// starting from the left index.
while ((lo < hi0) && (a[lo].compareTo(mid) < 0))
++lo;
// find an element that is <= the partition element
// starting from the right index.
while ((hi > lo0) && (a[hi].compareTo(mid) > 0))
--hi;
// if the indexes have not crossed, swap
if (lo <= hi) {
swap(a, lo, hi);
++lo;
--hi;
}
}
// If the right index has not reached the left side of array,
// sort the left partition.
if (lo0 < hi)
quickSort(a, lo0, hi);
// If the left index has not reached the right side of array,
// sort the right partition.
if (lo < hi0)
quickSort(a, lo, hi0);
}
} | java | {
"resource": ""
} |
q175808 | Util.swap | test | static private void swap(String a[], int i, int j) {
String T;
T = a[i];
a[i] = a[j];
a[j] = T;
} | java | {
"resource": ""
} |
q175809 | MFileOS.getExistingFile | test | static public MFileOS getExistingFile(String filename) {
if (filename == null) return null;
File file = new File(filename);
if (file.exists()) return new MFileOS(file);
return null;
} | java | {
"resource": ""
} |
q175810 | RotatedLatLon.rotate | test | private double[] rotate(double[] lonlat, double rot1, double rot2, double s) {
/* original code
double e = DEG2RAD * (lonlat[0] - rot1); //east
double n = DEG2RAD * lonlat[1]; //north
double cn = Math.cos(n);
double x = cn * Math.cos(e);
double y = cn * Math.sin(e);
double z = Math.sin(n);
double x2 = cosDlat * x + s * z;
double z2 = -s * x + cosDlat * z;
double R = Math.sqrt(x2 * x2 + y * y);
double e2 = Math.atan2(y, x2);
double n2 = Math.atan2(z2, R);
double rlon = RAD2DEG * e2 - rot2;
double rlat = RAD2DEG * n2;
return new double[]{rlon, rlat};
*/
double e = Math.toRadians(lonlat[0] - rot1); //east
double n = Math.toRadians(lonlat[1]); //north
double cn = Math.cos(n);
double x = cn * Math.cos(e);
double y = cn * Math.sin(e);
double z = Math.sin(n);
double x2 = cosDlat * x + s * z;
double z2 = -s * x + cosDlat * z;
double R = Math.sqrt(x2 * x2 + y * y);
double e2 = Math.atan2(y, x2);
double n2 = Math.atan2(z2, R);
double rlon = Math.toDegrees(e2) - rot2;
double rlat = Math.toDegrees(n2);
return new double[]{rlon, rlat};
} | java | {
"resource": ""
} |
q175811 | XMLStore.createFromFile | test | static public XMLStore createFromFile(String fileName, XMLStore storedDefaults) throws java.io.IOException {
File prefsFile = new File(fileName);
// open file if it exists
InputStream primIS = null, objIS = null;
if (prefsFile.exists() && prefsFile.length() > 0) {
primIS = new BufferedInputStream(new FileInputStream( prefsFile));
objIS = new BufferedInputStream(new FileInputStream( prefsFile));
}
if (debugWhichStore) System.out.println("XMLStore read from file "+fileName);
XMLStore store = new XMLStore( primIS, objIS, storedDefaults);
store.prefsFile = prefsFile;
return store;
} | java | {
"resource": ""
} |
q175812 | XMLStore.createFromInputStream | test | static public XMLStore createFromInputStream(InputStream is1, InputStream is2, XMLStore storedDefaults) throws java.io.IOException {
if (debugWhichStore) System.out.println("XMLStore read from input stream "+is1);
return new XMLStore( is1, is2, storedDefaults);
} | java | {
"resource": ""
} |
q175813 | XMLStore.createFromResource | test | static public XMLStore createFromResource(String resourceName, XMLStore storedDefaults)
throws java.io.IOException {
// open files if exist
Class c = XMLStore.class;
InputStream primIS = c.getResourceAsStream(resourceName);
InputStream objIS = c.getResourceAsStream(resourceName);
// debug
// InputStream debugIS = c.getResourceAsStream(fileName);
// System.out.println("Resource stream= "+fileName);
//thredds.util.IO.copy(debugIS, System.out);
if (primIS == null) {
//System.out.println("classLoader="+new XMLStore().getClass().getClassLoader());
throw new java.io.IOException("XMLStore.createFromResource cant find <"+resourceName+">");
}
if (debugWhichStore) System.out.println("XMLStore read from resource "+resourceName);
return new XMLStore( primIS, objIS, storedDefaults);
} | java | {
"resource": ""
} |
q175814 | XMLStore.makeStandardFilename | test | static public String makeStandardFilename(String appName, String storeName) {
// the directory
String userHome = null;
try {
userHome = System.getProperty("user.home");
} catch (Exception e) {
System.out.println( "XMLStore.makeStandardFilename: error System.getProperty(user.home) "+e);
}
if (null == userHome) userHome = ".";
String dirFilename = userHome+"/"+appName;
File f = new File(dirFilename);
if (!f.exists()) {
boolean ok = f.mkdirs(); // now ready for file creation in writeXML
if (!ok)
System.out.println("Error creating directories: " + f.getAbsolutePath());
}
return dirFilename +"/"+ storeName;
} | java | {
"resource": ""
} |
q175815 | XMLStore.save | test | public void save() throws java.io.IOException {
if (prefsFile == null)
throw new UnsupportedOperationException("XMLStore is read-only");
// get temporary file to write to
File prefTemp;
String parentFilename = prefsFile.getParent();
if (parentFilename == null) {
prefTemp = File.createTempFile("pref", ".xml");
} else {
File parentFile = new File(parentFilename);
prefTemp = File.createTempFile("pref", ".xml", parentFile);
}
prefTemp.deleteOnExit();
// save to the temp file
FileOutputStream fos = new FileOutputStream( prefTemp, false);
save( fos);
fos.close();
// success - rename files
Path xmlBackup = Paths.get(prefsFile.getAbsolutePath() + ".bak");
Path prefsPath = prefsFile.toPath();
if (Files.exists(prefsPath))
Files.move(prefsPath, xmlBackup, StandardCopyOption.REPLACE_EXISTING);
Files.move(prefTemp.toPath(), prefsFile.toPath(),
StandardCopyOption.REPLACE_EXISTING);
} | java | {
"resource": ""
} |
q175816 | XMLStore.save | test | public void save(OutputStream out) throws java.io.IOException {
outputExceptionMessage = null;
// the OutputMunger strips off the XMLEncoder header
OutputMunger bos = new OutputMunger( out);
PrintWriter pw = new PrintWriter( new OutputStreamWriter(bos,
CDM.utf8Charset));
XMLEncoder beanEncoder = new XMLEncoder( bos);
beanEncoder.setExceptionListener(new ExceptionListener() {
public void exceptionThrown(Exception exception) {
System.out.println("XMLStore.save() got Exception: abort saving the preferences!");
exception.printStackTrace();
outputExceptionMessage = exception.getMessage();
}
});
pw.printf("<?xml version='1.0' encoding='UTF-8'?>%n");
pw.printf("<preferences EXTERNAL_XML_VERSION='1.0'>%n");
if (!rootPrefs.isUserNode())
pw.printf(" <root type='system'>%n");
else
pw.printf(" <root type='user'>%n");
Indent indent = new Indent(2);
indent.incr();
writeXmlNode(bos, pw, rootPrefs, beanEncoder, indent);
if (outputExceptionMessage != null)
throw new IOException(outputExceptionMessage);
pw.printf(" </root>%n");
pw.printf("</preferences>%n");
pw.flush();
} | java | {
"resource": ""
} |
q175817 | DapSerializer.writeAtomicVariable | test | protected void
writeAtomicVariable(DataCursor data, SerialWriter dst)
throws IOException
{
DapVariable template = (DapVariable) data.getTemplate();
assert (this.ce.references(template));
DapType basetype = template.getBaseType();
// get the slices from constraint
List<Slice> slices = ce.getConstrainedSlices(template);
if(slices == null)
throw new DapException("Unknown variable: " + template.getFQN());
Object values = data.read(slices);
dst.writeAtomicArray(basetype, values);
} | java | {
"resource": ""
} |
q175818 | DapSerializer.writeStructure | test | protected void
writeStructure(DataCursor data, SerialWriter dst)
throws IOException
{
DapVariable template = (DapVariable) data.getTemplate();
DapStructure ds = (DapStructure) template.getBaseType();
assert (this.ce.references(template));
List<Slice> slices = ce.getConstrainedSlices(template);
Odometer odom = Odometer.factory(slices);
while(odom.hasNext()) {
Index index = odom.next();
DataCursor[] instance = (DataCursor[]) data.read(index);
writeStructure1(instance[0], dst);
}
} | java | {
"resource": ""
} |
q175819 | DapSerializer.writeStructure1 | test | protected void
writeStructure1(DataCursor instance, SerialWriter dst)
throws IOException
{
assert instance.getScheme() == DataCursor.Scheme.STRUCTURE;
DapVariable template = (DapVariable) instance.getTemplate();
assert (this.ce.references(template));
DapStructure ds = (DapStructure) template.getBaseType();
List<DapVariable> fields = ds.getFields();
for(int i = 0; i < fields.size(); i++) {
DapVariable field = fields.get(i);
if(!this.ce.references(field)) continue; // not in the view
DataCursor df = (DataCursor) instance.readField(i);
writeVariable(df, dst);
}
} | java | {
"resource": ""
} |
q175820 | DapSerializer.writeSequence | test | protected void
writeSequence(DataCursor data, SerialWriter dst)
throws IOException
{
DapVariable template = (DapVariable) data.getTemplate();
DapSequence ds = (DapSequence) template.getBaseType();
assert (this.ce.references(template));
List<Slice> slices = ce.getConstrainedSlices(template);
Odometer odom = Odometer.factory(slices);
if(false) while(odom.hasNext()) {
Index index = odom.next();
DataCursor[] instance = (DataCursor[]) data.read(index);
writeSequence1(instance[0], dst);
}
else {
DataCursor[] instances = (DataCursor[]) data.read(slices);
for(int i = 0; i < instances.length; i++) {
writeSequence1(instances[i], dst);
}
}
} | java | {
"resource": ""
} |
q175821 | DapSerializer.writeRecord | test | protected void
writeRecord(DataCursor record, SerialWriter dst)
throws IOException
{
DapVariable template = (DapVariable) record.getTemplate();
DapSequence seq = (DapSequence) template.getBaseType();
List<DapVariable> fields = seq.getFields();
for(int i = 0; i < fields.size(); i++) {
DapVariable field = fields.get(i);
if(!this.ce.references(field)) continue; // not in the view
DataCursor df = (DataCursor) record.readField(i);
writeVariable(df, dst);
}
} | java | {
"resource": ""
} |
q175822 | MessageScanner.isValidFile | test | static public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) throws IOException {
raf.seek(0);
if (!raf.searchForward(matcher, 40 * 1000)) return false; // must find "BUFR" in first 40k
raf.skipBytes(4);
BufrIndicatorSection is = new BufrIndicatorSection(raf);
if (is.getBufrEdition() > 4) return false;
// if(is.getBufrLength() > MAX_MESSAGE_SIZE) return false;
return !(is.getBufrLength() > raf.length());
} | java | {
"resource": ""
} |
q175823 | GempakStation.getWmoId | test | public String getWmoId() {
String wmoID = "";
if (!(stnm == GempakConstants.IMISSD)) {
wmoID = String.valueOf((int) (stnm / 10));
}
return wmoID;
} | java | {
"resource": ""
} |
q175824 | DbaseData.readRowN | test | int readRowN(DataInputStream ds, int n) {
if (n > nrec) return -1;
/* the assumption here is that the DataInputStream (ds)
* is already pointing at the right spot!
*/
try {
ds.readFully(field, 0, desc.FieldLength);
} catch (java.io.IOException e) {
return -1;
}
switch (desc.Type) {
case 'C':
case 'D':
character[n] = new String(field, CDM.utf8Charset);
break;
case 'N':
numeric[n] = Double.valueOf(new String(field, CDM.utf8Charset));
break;
case 'F': /* binary floating point */
if (desc.FieldLength == 4) {
numeric[n] = (double) Swap.swapFloat(field, 0);
} else {
numeric[n] = Swap.swapDouble(field, 0);
}
break;
case 'L':
switch (field[0]) {
case 't':
case 'T':
case 'Y':
case 'y':
logical[n] = true;
break;
default:
logical[n] = false;
break;
}
default:
return -1;
}
return 0;
} | java | {
"resource": ""
} |
q175825 | DbaseData.getData | test | public Object getData(int i) {
switch (type) {
case TYPE_CHAR:
return character[i];
case TYPE_NUMERIC:
return numeric[i];
case TYPE_BOOLEAN:
return logical[i];
}
return null;
} | java | {
"resource": ""
} |
q175826 | Grib2DataReader.getData0 | test | private float[] getData0(RandomAccessFile raf, Grib2Drs.Type0 gdrs) throws IOException {
int nb = gdrs.numberOfBits;
int D = gdrs.decimalScaleFactor;
float DD = (float) java.lang.Math.pow((double) 10, (double) D);
float R = gdrs.referenceValue;
int E = gdrs.binaryScaleFactor;
float EE = (float) java.lang.Math.pow(2.0, (double) E);
// LOOK: can # datapoints differ from bitmap and data ?
// dataPoints are number of points encoded, it could be less than the
// totalNPoints in the grid record if bitMap is used, otherwise equal
float[] data = new float[totalNPoints];
// Y * 10**D = R + (X1 + X2) * 2**E
// E = binary scale factor
// D = decimal scale factor
// R = reference value
// X1 = 0
// X2 = scaled encoded value
// data[ i ] = (R + ( X1 + X2) * EE)/DD ;
BitReader reader = new BitReader(raf, startPos + 5);
if (bitmap == null) {
for (int i = 0; i < totalNPoints; i++) {
//data[ i ] = (R + ( X1 + X2) * EE)/DD ;
data[i] = (R + reader.bits2UInt(nb) * EE) / DD;
}
} else {
for (int i = 0; i < totalNPoints; i++) {
if (GribNumbers.testBitIsSet(bitmap[i / 8], i % 8)) {
data[i] = (R + reader.bits2UInt(nb) * EE) / DD;
} else {
data[i] = staticMissingValue;
//data[i] = R / DD;
}
}
}
return data;
} | java | {
"resource": ""
} |
q175827 | Grib2DataReader.getData41 | test | private float[] getData41(RandomAccessFile raf, Grib2Drs.Type0 gdrs) throws IOException {
int nb = gdrs.numberOfBits;
int D = gdrs.decimalScaleFactor;
float DD = (float) java.lang.Math.pow((double) 10, (double) D);
float R = gdrs.referenceValue;
int E = gdrs.binaryScaleFactor;
float EE = (float) java.lang.Math.pow(2.0, (double) E);
// LOOK: can # datapoints differ from bitmap and data ?
// dataPoints are number of points encoded, it could be less than the
// totalNPoints in the grid record if bitMap is used, otherwise equal
float[] data = new float[totalNPoints];
// no data to decode, set to reference value
if (nb == 0) {
Arrays.fill(data, R);
return data;
}
// Y * 10**D = R + (X1 + X2) * 2**E
// E = binary scale factor
// D = decimal scale factor
// R = reference value
// X1 = 0
// X2 = scaled encoded value
// data[ i ] = (R + ( X1 + X2) * EE)/DD ;
byte[] buf = new byte[dataLength - 5];
raf.readFully(buf);
InputStream in = new ByteArrayInputStream(buf);
BufferedImage image = ImageIO.read(in);
if (nb != image.getColorModel().getPixelSize()) {
logger.debug("PNG pixel size disagrees with grib number of bits: ",
image.getColorModel().getPixelSize(), nb);
}
DataBuffer db = image.getRaster().getDataBuffer();
if (bitmap == null) {
for (int i = 0; i < dataNPoints; i++) {
data[i] = (R + db.getElem(i) * EE) / DD;
}
} else {
for (int bitPt = 0, dataPt = 0; bitPt < totalNPoints; bitPt++) {
if (GribNumbers.testBitIsSet(bitmap[bitPt / 8], bitPt % 8)) {
data[bitPt] = (R + db.getElem(dataPt++) * EE) / DD;
} else {
data[bitPt] = staticMissingValue;
}
}
}
return data;
} | java | {
"resource": ""
} |
q175828 | CDMCursor.read | test | @Override
public Object
read(List<Slice> slices)
throws DapException
{
switch (this.scheme) {
case ATOMIC:
return readAtomic(slices);
case STRUCTURE:
if(((DapVariable) this.getTemplate()).getRank() > 0
|| DapUtil.isScalarSlices(slices))
throw new DapException("Cannot slice a scalar variable");
CDMCursor[] instances = new CDMCursor[1];
instances[0] = this;
return instances;
case SEQUENCE:
if(((DapVariable) this.getTemplate()).getRank() > 0
|| DapUtil.isScalarSlices(slices))
throw new DapException("Cannot slice a scalar variable");
instances = new CDMCursor[1];
instances[0] = this;
return instances;
case STRUCTARRAY:
Odometer odom = Odometer.factory(slices);
instances = new CDMCursor[(int) odom.totalSize()];
for(int i = 0; odom.hasNext(); i++) {
instances[i] = readStructure(odom.next());
}
return instances;
case SEQARRAY:
instances = readSequence(slices);
return instances;
default:
throw new DapException("Attempt to slice a scalar object");
}
} | java | {
"resource": ""
} |
q175829 | CFGridWriter.makeFile | test | static public void makeFile(String location, ucar.nc2.dt.GridDataset gds, List<String> gridList, LatLonRect llbb, CalendarDateRange range)
throws IOException, InvalidRangeException {
CFGridWriter writer = new CFGridWriter();
writer.makeFile(location, gds, gridList, llbb, range, false, 1, 1, 1);
} | java | {
"resource": ""
} |
q175830 | CFGridWriter.makeGridFileSizeEstimate | test | public long makeGridFileSizeEstimate(ucar.nc2.dt.GridDataset gds, List<String> gridList,
LatLonRect llbb, int horizStride,
Range zRange,
CalendarDateRange dateRange, int stride_time,
boolean addLatLon) throws IOException, InvalidRangeException {
return makeOrTestSize(null, gds, gridList, llbb, horizStride, zRange, dateRange, stride_time, addLatLon, true, NetcdfFileWriter.Version.netcdf3);
} | java | {
"resource": ""
} |
q175831 | CFGridWriter.makeFile | test | public void makeFile(String location, ucar.nc2.dt.GridDataset gds, List<String> gridList,
LatLonRect llbb, CalendarDateRange range,
boolean addLatLon,
int horizStride, int stride_z, int stride_time)
throws IOException, InvalidRangeException {
makeFile(location, gds, gridList, llbb, horizStride, null, range, stride_time, addLatLon, NetcdfFileWriter.Version.netcdf3);
} | java | {
"resource": ""
} |
q175832 | StationRenderer.setStations | test | public void setStations(java.util.List<ucar.unidata.geoloc.Station> stns) {
stations = new ArrayList<StationUI>( stns.size());
stationHash.clear();
for (int i = 0; i < stns.size(); i++) {
ucar.unidata.geoloc.Station s = (ucar.unidata.geoloc.Station) stns.get(i);
StationUI sui = new StationUI( s); // wrap in a StationUI
stations.add(sui); // wrap in a StationUI
stationHash.put( s.getName(), sui);
}
posWasCalc = false;
calcWorldPos();
} | java | {
"resource": ""
} |
q175833 | StationRenderer.setSelectedStation | test | public void setSelectedStation( String name) {
StationUI sui = (StationUI) stationHash.get( name);
if (sui != null) {
setSelectedStation( sui);
}
} | java | {
"resource": ""
} |
q175834 | StationRenderer.pick | test | public ucar.unidata.geoloc.Station pick(Point2D pickPt) {
if (world2Normal == null || pickPt == null || stations.isEmpty()) return null;
world2Normal.transform(pickPt, ptN); // work in normalized coordinate space
StationUI closest = (StationUI) stationGrid.findIntersection(ptN);
setSelectedStation( closest);
return getSelectedStation();
} | java | {
"resource": ""
} |
q175835 | StationRenderer.pickClosest | test | public ucar.unidata.geoloc.Station pickClosest(Point2D pickPt) {
if (world2Normal == null || pickPt == null || stations.isEmpty()) return null;
world2Normal.transform(pickPt, ptN); // work in normalized coordinate space
StationUI closest = (StationUI) stationGrid.findClosest(ptN);
if (debug) System.out.println("closest= " +closest);
setSelectedStation( closest);
return getSelectedStation();
} | java | {
"resource": ""
} |
q175836 | StationRenderer.getSelectedStation | test | public ucar.unidata.geoloc.Station getSelectedStation() {
return (selected != null) ? selected.ddStation : null;
} | java | {
"resource": ""
} |
q175837 | McGridDefRecord.getProjName | test | public String getProjName(int type) {
String projName;
switch (type) {
case PSEUDO_MERCATOR:
case PSEUDO_MERCATOR_GENERAL:
projName = "MERC";
break;
case PS_OR_LAMBERT_CONIC:
projName = (vals[38] == vals[39])
? "PS"
: "CONF";
break;
case EQUIDISTANT:
projName = "EQUI";
break;
case LAMBERT_CONFORMAL_TANGENT:
projName = "CONF";
break;
default:
projName = "NAV" + type;
}
return projName;
} | java | {
"resource": ""
} |
q175838 | StationDatasetCollection.getStations | test | public List getStations(ucar.unidata.geoloc.LatLonRect boundingBox) throws IOException {
return typical.getStations(boundingBox);
} | java | {
"resource": ""
} |
q175839 | StationDatasetCollection.getStation | test | public ucar.unidata.geoloc.Station getStation(String name) {
return typical.getStation(name);
} | java | {
"resource": ""
} |
q175840 | StationDatasetCollection.getDataIterator | test | public DataIterator getDataIterator(ucar.unidata.geoloc.Station s) throws IOException {
return new StationDataIterator(s);
} | java | {
"resource": ""
} |
q175841 | StationDatasetCollection.getDataIterator | test | public DataIterator getDataIterator(ucar.unidata.geoloc.Station s, Date start, Date end) throws IOException {
return new StationDateDataIterator(s, start, end);
} | java | {
"resource": ""
} |
q175842 | Ray.readData | test | public void readData(RandomAccessFile raf, String abbrev, Range gateRange, IndexIterator ii) throws IOException {
long offset = rayOffset;
offset += (getDataOffset(abbrev) * 2 - 2);
raf.seek(offset);
byte[] b2 = new byte[2];
int dataCount = getGateCount(abbrev);
byte[] data = new byte[dataCount * 2];
raf.readFully(data);
for (int gateIdx : gateRange) {
if (gateIdx >= dataCount)
ii.setShortNext(uf_header2.missing);
else {
b2[0] = data[gateIdx * 2];
b2[1] = data[gateIdx * 2 + 1];
short value = getShort(b2, 0);
ii.setShortNext(value);
}
}
} | java | {
"resource": ""
} |
q175843 | MAVector.dot | test | public double dot(MAVector v) {
if (nelems != v.getNelems())
throw new IllegalArgumentException("MAVector.dot "+nelems+" != "+ v.getNelems());
double sum = 0.0;
for (int k=0; k<nelems; k++)
sum += getDouble(k) * v.getDouble(k);
return sum;
} | java | {
"resource": ""
} |
q175844 | MAVector.norm | test | public double norm() {
double sum = 0.0;
for (int k=0; k<nelems; k++) {
double val = getDouble(k);
sum += val * val;
}
return Math.sqrt(sum);
} | java | {
"resource": ""
} |
q175845 | MAVector.normalize | test | public void normalize() {
double norm = norm();
if (norm <= 0.0)
return;
for (int k=0; k<nelems; k++) {
double val = getDouble(k);
setDouble(k, val/norm);
}
} | java | {
"resource": ""
} |
q175846 | CatalogBuilder.setServices | test | private void setServices(Iterable<DatasetBuilder> dsIter) {
for (DatasetBuilder dsb : dsIter) {
for (Service s : dsb.getServices()) {
addService(s);
}
setServices(dsb.getDatasets()); // recurse
}
} | java | {
"resource": ""
} |
q175847 | Grib1ParamTableReader.getParameter | test | public Grib1Parameter getParameter(int id) {
if (parameters == null) {
parameters = readParameterTable();
}
return parameters.get(id);
} | java | {
"resource": ""
} |
q175848 | Grib1ParamTableReader.getLocalParameter | test | public Grib1Parameter getLocalParameter(int id) {
if (parameters == null) {
parameters = readParameterTable();
}
return parameters.get(id);
} | java | {
"resource": ""
} |
q175849 | PrefixDBImpl.addName | test | public void addName(final String name, final double value)
throws PrefixExistsException {
final Prefix prefix = new PrefixName(name, value);
nameSet.add(prefix);
} | java | {
"resource": ""
} |
q175850 | PrefixDBImpl.addSymbol | test | public void addSymbol(final String symbol, final double value)
throws PrefixExistsException {
final Prefix prefix = new PrefixSymbol(symbol, value);
symbolSet.add(prefix);
valueMap.put(new Double(value), prefix);
} | java | {
"resource": ""
} |
q175851 | PrefixDBImpl.getPrefix | test | private static Prefix getPrefix(final String string, final Set<Prefix> set) {
for (final Iterator<Prefix> iter = set.iterator(); iter.hasNext();) {
final Prefix prefix = iter.next();
final int comp = prefix.compareTo(string);
if (comp == 0) {
return prefix;
}
if (comp > 0) {
break;
}
}
return null;
} | java | {
"resource": ""
} |
q175852 | ADNWriter.emailOK | test | protected boolean emailOK(ThreddsMetadata.Source p) {
String email = p.getEmail();
return email.indexOf('@') >= 0; // should really do a regexp
} | java | {
"resource": ""
} |
q175853 | WKTParser.getParameter | test | public double getParameter(String name) {
Double val = (Double) parameters.get(name.toLowerCase());
if (val == null) {
throw new IllegalArgumentException("no parameter called " + name);
}
return val.doubleValue();
} | java | {
"resource": ""
} |
q175854 | Grib1SectionGridDefinition.calcCRC | test | public long calcCRC() {
long crc;
if (rawData == null)
crc = predefinedGridDefinitionCenter << 16 + predefinedGridDefinition;
else {
CRC32 crc32 = new CRC32();
crc32.update(rawData);
crc = crc32.getValue();
}
return crc;
} | java | {
"resource": ""
} |
q175855 | Grib1SectionGridDefinition.isThin | test | public final boolean isThin() {
if (rawData == null) return false;
int octet5 = getOctet(5);
int nv = getOctet(4);
return (octet5 != 255) && (nv == 0 || nv == 255);
} | java | {
"resource": ""
} |
q175856 | AbstractCursor.fieldIndex | test | @Override
public int fieldIndex(String name)
throws DapException
{
DapStructure ds;
if(getTemplate().getSort().isCompound())
ds = (DapStructure) getTemplate();
else if(getTemplate().getSort().isVar()
&& (((DapVariable) getTemplate()).getBaseType().getSort().isCompound()))
ds = (DapStructure) ((DapVariable) getTemplate()).getBaseType();
else
throw new DapException("Attempt to get field name on non-compound object");
int i = ds.indexByName(name);
if(i < 0)
throw new DapException("Unknown field name: " + name);
return i;
} | java | {
"resource": ""
} |
q175857 | Grib1ParamTime.getTimeTypeName | test | public static String getTimeTypeName(int timeRangeIndicator) {
String timeRange;
switch (timeRangeIndicator) {
/* Forecast product valid for reference time + P1 (P1 > 0), or
Uninitialized analysis product for reference time (P1 = 0), or
Image product for reference time (P1 = 0) */
case 0:
timeRange = "Uninitialized analysis / image product / forecast product valid for RT + P1";
break;
// Initialized analysis product for reference time (P1 = 0)
case 1:
timeRange = "Initialized analysis product for reference time";
break;
// Product with a valid time ranging between reference time + P1 and reference time + P2
case 2:
timeRange = "product valid, interval = (RT + P1) to (RT + P2)";
break;
// Average (reference time + P1 to reference time + P2)
case 3:
timeRange = "Average, interval = (RT + P1) to (RT + P2)";
break;
/* Accumulation (reference time + P1 to reference time + P2) product considered valid at
reference time + P2 */
case 4:
timeRange = "Accumulation, interval = (RT + P1) to (RT + P2)";
break;
/* Difference (reference time + P2 minus reference time + P1) product considered valid at
reference time + P2 */
case 5:
timeRange = "Difference, interval = (RT + P2) - (RT + P1)";
break;
// Average (reference time - P1 to reference time - P2)
case 6:
timeRange = "Average, interval = (RT - P1) to (RT - P2)";
break;
// Average (reference time - P1 to reference time + P2)
case 7:
timeRange = "Average, interval = (RT - P1) to (RT + P2)";
break;
// P1 occupies octets 19 and 20; product valid at reference time + P1
case 10:
timeRange = "product valid at RT + P1";
break;
/* Climatological mean value: multiple year averages of quantities which are themselves
means over some period of time (P2) less than a year. The reference time (R) indicates the
date and time of the start of a period of time, given by R to R + P2, over which a mean is
formed; N indicates the number of such period-means that are averaged together to form
the climatological value, assuming that the N period-mean fields are separated by one
year. The reference time indicates the start of the N-year climatology.
If P1 = 0 then the data averaged in the basic interval P2 are assumed to be continuous, i.e. all available data
are simply averaged together.
If P1 = 1 (the unit of time octet 18, Code table 4 is not
relevant here) then the data averaged together in the basic interval P2 are valid only at the
time (hour, minute) given in the reference time, for all the days included in the P2 period.
The units of P2 are given by the contents of octet 18 and Code table 4 */
case 51:
timeRange = "Climatological mean values from RT to (RT + P2)";
// if (p1 == 0) timeRange += " continuous";
break;
/* Average of N forecasts (or initialized analyses); each product has forecast period of P1
(P1 = 0 for initialized analyses); products have reference times at intervals of P2, beginning
at the given reference time */
case 113:
timeRange = "Average of N forecasts, intervals = (refTime + i * P2, refTime + i * P2 + P1)";
break;
/* Accumulation of N forecasts (or initialized analyses); each product has forecast period of
P1 (P1 = 0 for initialized analyses); products have reference times at intervals of P2,
beginning at the given reference time */
case 114:
timeRange = "Accumulation of N forecasts, intervals = (refTime + i * P2, refTime + i * P2 + P1)";
break;
/* Average of N forecasts, all with the same reference time; the first has a forecast period of
P1, the remaining forecasts follow at intervals of P2 */
case 115:
timeRange = "Average of N forecasts, intervals = (refTime, refTime + P1 + i * P2)";
break;
/* Accumulation of N forecasts, all with the same reference time; the first has a forecast
period of P1, the remaining forecasts follow at intervals of P2 */
case 116:
timeRange = "Accumulation of N forecasts, intervals = (refTime, refTime + P1 + i * P2)";
break;
/* Average of N forecasts; the first has a forecast period of P1, the subsequent ones have
forecast periods reduced from the previous one by an interval of P2; the reference time for
the first is given in octets 13 to 17, the subsequent ones have reference times increased
from the previous one by an interval of P2. Thus all the forecasts have the same valid time,
given by the initial reference time + P1 */
case 117:
timeRange = "Average of N forecasts, intervals = (refTime + i * P2, refTime + P1)";
break;
/* Temporal variance, or covariance, of N initialized analyses; each product has forecast
period of P1 = 0; products have reference times at intervals of P2, beginning at the given
reference time */
case 118:
timeRange = "Temporal variance or covariance of N initialized analyses, timeCoord = (refTime + i * P2)";
break;
/* Standard deviation of N forecasts, all with the same reference time with respect to the time
average of forecasts; the first forecast has a forecast period of P1, the remaining forecasts
follow at intervals of P2 */
case 119:
timeRange = "Standard Deviation of N forecasts, timeCoord = (refTime + P1 + i * P2)";
break;
// ECMWF "Average of N Forecast" added 11/21/2014. pretend its WMO standard. maybe should move to ecmwf ??
// see "http://emoslib.sourcearchive.com/documentation/000370.dfsg.2/grchk1_8F-source.html"
// C Add Time range indicator = 120 Average of N Forecast. Each product
// C is an accumulation from forecast lenght P1 to forecast
// C lenght P2, with reference times at intervals P2-P1
case 120:
timeRange = "Average of N Forecasts (ECMWF), accumulation from forecast P1 to P2, with reference times at intervals P2-P1";
break;
// Average of N uninitialized analyses, starting at the reference time, at intervals of P2
case 123:
timeRange = "Average of N uninitialized analyses, intervals = (refTime, refTime + i * P2)";
break;
// Accumulation of N uninitialized analyses, starting at the reference time, at intervals of P2
case 124:
timeRange = "Accumulation of N uninitialized analyses, intervals = (refTime, refTime + i * P2)";
break;
/* Standard deviation of N forecasts, all with the same reference time with respect to time
average of the time tendency of forecasts; the first forecast has a forecast period of P1,
the remaining forecasts follow at intervals of P2 */
case 125:
timeRange = "Standard deviation of N forecasts, intervals = (refTime, refTime + P1 + i * P2)";
break;
default:
timeRange = "Unknown Time Range Indicator " + timeRangeIndicator;
}
return timeRange;
} | java | {
"resource": ""
} |
q175858 | Grib1ParamTime.getTimeCoord | test | public String getTimeCoord() {
if (isInterval()) {
int[] intv = getInterval();
return intv[0] + "-" + intv[1];
}
return Integer.toString(getForecastTime());
} | java | {
"resource": ""
} |
q175859 | CFPolygon.setNext | test | public void setNext(Polygon next) {
if(next instanceof CFPolygon) {
setNext((CFPolygon) next);
}
else this.next = next;
} | java | {
"resource": ""
} |
q175860 | CFPolygon.setPrev | test | public void setPrev(Polygon prev) {
if(prev instanceof CFPolygon) {
setPrev((CFPolygon) prev);
}
else this.prev = prev;
} | java | {
"resource": ""
} |
q175861 | InvService.findProperty | test | public String findProperty(String name) {
InvProperty result = null;
for (InvProperty p : properties) {
if (p.getName().equals(name))
result = p;
}
return (result == null) ? null : result.getValue();
} | java | {
"resource": ""
} |
q175862 | JTableProjection.setCurrentProjection | test | public void setCurrentProjection(ProjectionImpl proj) {
int row;
if (0 <= (row = model.search(proj))) {
if (debug) System.out.println(" PTsetCurrentProjection found = "+ row);
selectedRow = row;
setRowSelectionInterval(row, row);
} else {
if (debug) System.out.println(" PTsetCurrentProjection not found = "+ row);
selectedRow = -1;
clearSelection();
}
} | java | {
"resource": ""
} |
q175863 | TimeOffsetAxis.subsetFromTime | test | public Optional<TimeOffsetAxis> subsetFromTime(SubsetParams params, CalendarDate runDate) {
CoordAxisHelper helper = new CoordAxisHelper(this);
CoverageCoordAxisBuilder builder = null;
if (params.isTrue(SubsetParams.timePresent)) {
double offset = getOffsetInTimeUnits(runDate, CalendarDate.present());
builder = helper.subsetClosest(offset);
}
CalendarDate dateWanted = (CalendarDate) params.get(SubsetParams.time);
if (dateWanted != null) { // convertFrom, convertTo
double offset = getOffsetInTimeUnits(runDate, dateWanted);
builder = helper.subsetClosest(offset);
}
Integer stride = (Integer) params.get(SubsetParams.timeStride);
if (stride == null || stride < 0) stride = 1;
CalendarDateRange dateRange = (CalendarDateRange) params.get(SubsetParams.timeRange);
if (dateRange != null) {
double min = getOffsetInTimeUnits(runDate, dateRange.getStart());
double max = getOffsetInTimeUnits(runDate, dateRange.getEnd());
Optional<CoverageCoordAxisBuilder> buildero = helper.subset(min, max, stride);
if (buildero.isPresent()) builder = buildero.get();
else return Optional.empty(buildero.getErrorMessage());
}
assert (builder != null);
// all the offsets are reletive to rundate
builder.setReferenceDate(runDate);
return Optional.of(new TimeOffsetAxis(builder));
} | java | {
"resource": ""
} |
q175864 | NetcdfFile.registerIOProvider | test | static public void registerIOProvider(String className) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
Class ioClass = NetcdfFile.class.getClassLoader().loadClass(className);
registerIOProvider(ioClass);
} | java | {
"resource": ""
} |
q175865 | NetcdfFile.registerIOProvider | test | static public void registerIOProvider(Class iospClass, boolean last)
throws IllegalAccessException, InstantiationException {
IOServiceProvider spi;
spi = (IOServiceProvider) iospClass.newInstance(); // fail fast
if (userLoads && !last)
registeredProviders.add(0, spi); // put user stuff first
else registeredProviders.add(spi);
} | java | {
"resource": ""
} |
q175866 | NetcdfFile.registerIOProviderPreferred | test | static public void registerIOProviderPreferred(Class iospClass, Class target)
throws IllegalAccessException, InstantiationException
{
iospDeRegister(iospClass); // forcibly de-register
int pos = -1;
for(int i = 0; i < registeredProviders.size(); i++) {
IOServiceProvider candidate = registeredProviders.get(i);
if(candidate.getClass() == target) {
if(pos < i)
pos = i;
break; // this is where is must be placed
}
}
if(pos < 0) pos = 0;
IOServiceProvider spi = (IOServiceProvider) iospClass.newInstance(); // fail fast
registeredProviders.add(pos, spi); // insert before target
} | java | {
"resource": ""
} |
q175867 | NetcdfFile.iospRegistered | test | static public boolean iospRegistered(Class iospClass) {
for (IOServiceProvider spi : registeredProviders) {
if (spi.getClass() == iospClass) return true;
}
return false;
} | java | {
"resource": ""
} |
q175868 | NetcdfFile.iospDeRegister | test | static public boolean iospDeRegister(Class iospClass) {
for (int i=0;i<registeredProviders.size();i++) {
IOServiceProvider spi = registeredProviders.get(i);
if (spi.getClass() == iospClass) {
registeredProviders.remove(i);
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q175869 | NetcdfFile.canOpen | test | static public boolean canOpen(String location) throws IOException {
ucar.unidata.io.RandomAccessFile raf = null;
try {
raf = getRaf(location, -1);
return (raf != null) && canOpen(raf);
} finally {
if (raf != null) raf.close();
}
} | java | {
"resource": ""
} |
q175870 | NetcdfFile.openInMemory | test | public static NetcdfFile openInMemory(String name, byte[] data, String iospClassName) throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException {
ucar.unidata.io.InMemoryRandomAccessFile raf = new ucar.unidata.io.InMemoryRandomAccessFile(name, data);
Class iospClass = NetcdfFile.class.getClassLoader().loadClass(iospClassName);
IOServiceProvider spi = (IOServiceProvider) iospClass.newInstance();
return new NetcdfFile(spi, raf, name, null);
} | java | {
"resource": ""
} |
q175871 | NetcdfFile.openInMemory | test | public static NetcdfFile openInMemory(String name, byte[] data) throws IOException {
ucar.unidata.io.InMemoryRandomAccessFile raf = new ucar.unidata.io.InMemoryRandomAccessFile(name, data);
return open(raf, name, null, null);
} | java | {
"resource": ""
} |
q175872 | NetcdfFile.openInMemory | test | public static NetcdfFile openInMemory(String filename) throws IOException {
File file = new File(filename);
ByteArrayOutputStream bos = new ByteArrayOutputStream((int) file.length());
try (InputStream in = new BufferedInputStream(new FileInputStream(filename))) {
IO.copy(in, bos);
}
return openInMemory(filename, bos.toByteArray());
} | java | {
"resource": ""
} |
q175873 | NetcdfFile.openInMemory | test | public static NetcdfFile openInMemory(URI uri) throws IOException {
URL url = uri.toURL();
byte[] contents = IO.readContentsToByteArray(url.openStream());
return openInMemory(uri.toString(), contents);
} | java | {
"resource": ""
} |
q175874 | NetcdfFile.findGlobalAttributeIgnoreCase | test | public Attribute findGlobalAttributeIgnoreCase(String name) {
for (Attribute a : gattributes) {
if (name.equalsIgnoreCase(a.getShortName()))
return a;
}
return null;
} | java | {
"resource": ""
} |
q175875 | NetcdfFile.toNcML | test | public String toNcML(String url) throws IOException {
NcMLWriter ncmlWriter = new NcMLWriter();
ncmlWriter.setWriteVariablesPredicate(NcMLWriter.writeNoVariablesPredicate);
Element netcdfElement = ncmlWriter.makeNetcdfElement(this, url);
return ncmlWriter.writeToString(netcdfElement);
} | java | {
"resource": ""
} |
q175876 | NetcdfFile.writeCDL | test | public void writeCDL(OutputStream out, boolean strict) {
PrintWriter pw = new PrintWriter(new OutputStreamWriter(out, CDM.utf8Charset));
toStringStart(pw, strict);
toStringEnd(pw);
pw.flush();
} | java | {
"resource": ""
} |
q175877 | NetcdfFile.writeCDL | test | public void writeCDL(PrintWriter pw, boolean strict) {
toStringStart(pw, strict);
toStringEnd(pw);
pw.flush();
} | java | {
"resource": ""
} |
q175878 | NetcdfFile.writeCDL | test | protected void writeCDL(Formatter f, Indent indent, boolean strict) {
toStringStart(f, indent, strict);
f.format("%s}%n", indent);
} | java | {
"resource": ""
} |
q175879 | NetcdfFile.addAttribute | test | public Attribute addAttribute(Group parent, Attribute att) {
if (immutable) throw new IllegalStateException("Cant modify");
if (parent == null) parent = rootGroup;
parent.addAttribute(att);
return att;
} | java | {
"resource": ""
} |
q175880 | NetcdfFile.addAttribute | test | public Attribute addAttribute(Group parent, String name, String value) {
if (immutable) throw new IllegalStateException("Cant modify");
if (value == null) return null;
if (parent == null) parent = rootGroup;
Attribute att = new Attribute(name, value);
parent.addAttribute(att);
return att;
} | java | {
"resource": ""
} |
q175881 | NetcdfFile.addGroup | test | public Group addGroup(Group parent, Group g) {
if (immutable) throw new IllegalStateException("Cant modify");
if (parent == null) parent = rootGroup;
parent.addGroup(g);
return g;
} | java | {
"resource": ""
} |
q175882 | NetcdfFile.addDimension | test | public Dimension addDimension(Group parent, Dimension d) {
if (immutable) throw new IllegalStateException("Cant modify");
if (parent == null) parent = rootGroup;
parent.addDimension(d);
return d;
} | java | {
"resource": ""
} |
q175883 | NetcdfFile.removeDimension | test | public boolean removeDimension(Group g, String dimName) {
if (immutable) throw new IllegalStateException("Cant modify");
if (g == null) g = rootGroup;
return g.removeDimension(dimName);
} | java | {
"resource": ""
} |
q175884 | NetcdfFile.addVariable | test | public Variable addVariable(Group g, Variable v) {
if (immutable) throw new IllegalStateException("Cant modify");
if (g == null) g = rootGroup;
if (v != null) g.addVariable(v);
return v;
} | java | {
"resource": ""
} |
q175885 | NetcdfFile.addVariable | test | public Variable addVariable(Group g, String shortName, DataType dtype, String dims) {
if (immutable) throw new IllegalStateException("Cant modify");
if (g == null) g = rootGroup;
Variable v = new Variable(this, g, null, shortName);
v.setDataType(dtype);
v.setDimensions(dims);
g.addVariable(v);
return v;
} | java | {
"resource": ""
} |
q175886 | NetcdfFile.addStringVariable | test | public Variable addStringVariable(Group g, String shortName, String dims, int strlen) {
if (immutable) throw new IllegalStateException("Cant modify");
if (g == null) g = rootGroup;
String dimName = shortName + "_strlen";
addDimension(g, new Dimension(dimName, strlen));
Variable v = new Variable(this, g, null, shortName);
v.setDataType(DataType.CHAR);
v.setDimensions(dims + " " + dimName);
g.addVariable(v);
return v;
} | java | {
"resource": ""
} |
q175887 | NetcdfFile.removeVariable | test | public boolean removeVariable(Group g, String varName) {
if (immutable) throw new IllegalStateException("Cant modify");
if (g == null) g = rootGroup;
return g.removeVariable(varName);
} | java | {
"resource": ""
} |
q175888 | NetcdfFile.sendIospMessage | test | public Object sendIospMessage(Object message) {
if (null == message) return null;
if (message == IOSP_MESSAGE_ADD_RECORD_STRUCTURE) {
Variable v = rootGroup.findVariable("record");
boolean gotit = (v != null) && (v instanceof Structure);
return gotit || makeRecordStructure();
} else if (message == IOSP_MESSAGE_REMOVE_RECORD_STRUCTURE) {
Variable v = rootGroup.findVariable("record");
boolean gotit = (v != null) && (v instanceof Structure);
if (gotit) {
rootGroup.remove(v);
variables.remove(v);
removeRecordStructure();
}
return (gotit);
}
if (spi != null)
return spi.sendIospMessage(message);
return null;
} | java | {
"resource": ""
} |
q175889 | NetcdfFile.makeRecordStructure | test | protected Boolean makeRecordStructure() {
if (immutable) throw new IllegalStateException("Cant modify");
Boolean didit = false;
if ((spi != null) && (spi instanceof N3iosp) && hasUnlimitedDimension()) {
didit = (Boolean) spi.sendIospMessage(IOSP_MESSAGE_ADD_RECORD_STRUCTURE);
}
return didit;
} | java | {
"resource": ""
} |
q175890 | NetcdfFile.finish | test | public void finish() {
if (immutable) throw new IllegalStateException("Cant modify");
variables = new ArrayList<>();
dimensions = new ArrayList<>();
gattributes = new ArrayList<>();
finishGroup(rootGroup);
} | java | {
"resource": ""
} |
q175891 | NetcdfFile.readSection | test | public Array readSection(String variableSection) throws IOException, InvalidRangeException {
/* if (unlocked)
throw new IllegalStateException("File is unlocked - cannot use"); */
ParsedSectionSpec cer = ParsedSectionSpec.parseVariableSection(this, variableSection);
if (cer.child == null) {
return cer.v.read(cer.section);
}
if (spi == null)
return IospHelper.readSection(cer);
else
// allow iosp to optimize
return spi.readSection(cer);
} | java | {
"resource": ""
} |
q175892 | NetcdfFile.readToByteChannel | test | protected long readToByteChannel(ucar.nc2.Variable v, Section section, WritableByteChannel wbc)
throws java.io.IOException, ucar.ma2.InvalidRangeException {
//if (unlocked)
// throw new IllegalStateException("File is unlocked - cannot use");
if ((spi == null) || v.hasCachedData())
return IospHelper.copyToByteChannel(v.read(section), wbc);
return spi.readToByteChannel(v, section, wbc);
} | java | {
"resource": ""
} |
q175893 | NetcdfFile.readArrays | test | public java.util.List<Array> readArrays(java.util.List<Variable> variables) throws IOException {
java.util.List<Array> result = new java.util.ArrayList<>();
for (Variable variable : variables)
result.add(variable.read());
return result;
} | java | {
"resource": ""
} |
q175894 | NetcdfFile.read | test | public Array read(String variableSection, boolean flatten) throws IOException, InvalidRangeException {
if (!flatten)
throw new UnsupportedOperationException("NetdfFile.read(String variableSection, boolean flatten=false)");
return readSection(variableSection);
} | java | {
"resource": ""
} |
q175895 | NetcdfFile.makeFullName | test | static protected String makeFullName(CDMNode node, String reservedChars) {
Group parent = node.getParentGroup();
if (((parent == null) || parent.isRoot())
&& !node.isMemberOfStructure()) // common case?
return EscapeStrings.backslashEscape(node.getShortName(), reservedChars);
StringBuilder sbuff = new StringBuilder();
appendGroupName(sbuff, parent, reservedChars);
appendStructureName(sbuff, node, reservedChars);
return sbuff.toString();
} | java | {
"resource": ""
} |
q175896 | NetcdfFile.makeFullNameWithString | test | protected String makeFullNameWithString(Group parent, String name) {
name = makeValidPathName(name); // escape for use in full name
StringBuilder sbuff = new StringBuilder();
appendGroupName(sbuff, parent, null);
sbuff.append(name);
return sbuff.toString();
} | java | {
"resource": ""
} |
q175897 | CompositeMFileFilter.include | test | private boolean include(MFile mfile) {
if (includeFilters == null) return true;
for (MFileFilter filter : includeFilters) {
if (filter.accept(mfile))
return true;
}
return false;
} | java | {
"resource": ""
} |
q175898 | CompositeMFileFilter.exclude | test | private boolean exclude(MFile mfile) {
if (excludeFilters == null) return false;
for (MFileFilter filter : excludeFilters) {
if (filter.accept(mfile))
return true;
}
return false;
} | java | {
"resource": ""
} |
q175899 | CompositeMFileFilter.andFilter | test | private boolean andFilter(MFile mfile) {
if (andFilters == null) return true;
for (MFileFilter filter : andFilters) {
if (!filter.accept(mfile))
return false;
}
return true;
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.