public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) { DMSPHeader localHeader = new DMSPHeader(); return (localHeader.isValidFile(raf)); }
Object readUCharArray1D(int offsetInRecord) throws IOException { // XDR u_char fills 4 bytes but only uses one byte. int elementSizeInBytes = 4; byte[] elementArray = new byte[elementSizeInBytes]; byte[] array = new byte[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readFully(elementArray); array[i] = elementArray[3]; this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
/** Check basic DMSP file validity of given random access file. */ boolean isValidFile( ucar.unidata.io.RandomAccessFile raFile ) { // @todo This method should not be called if read() has or will be called on this instance. this.raFile = raFile; try { this.actualSize = raFile.length(); } catch ( IOException e ) { return( false ); } try { this.readHeaderFromFile( raFile ); this.handleFileInformation(); this.handleProcessingInformation(); this.handleSatelliteInformation(); this.handleSensorInformation(); } catch ( IOException e ) { return( false ); } return( true ); }
this.readHeaderFromFile( raFile ); this.handleFileInformation(); this.handleProcessingInformation(); this.handleSatelliteInformation(); this.handleOrbitInformation(); this.handleSensorInformation(); this.handleQCInformation();
this.raf.order(ucar.unidata.io.RandomAccessFile.BIG_ENDIAN); // DMSP files are XDR this.header = new DMSPHeader(); this.header.read(this.raf, this.ncfile); nonScanDimList.add(this.header.getNumDataRecordsDim()); scanDimList.add(this.header.getNumDataRecordsDim()); scanDimList.add(this.header.getNumSamplesPerBandDim()); } else if (curVariable.getShortName().equals("time")) { curVariable.addAttribute(new Attribute("calculatedVariable", "Using the satellite epoch for each scan.")); this.startDateString = this.header.getStartDateAtt().getStringValue(); try { this.startDate = DMSPHeader.DateFormatHandler.ISO_DATE_TIME.getDateFromDateTimeString(this.startDateString);
v2.getShortName().equals(VariableInfo.LONGITUDE.getName())) { if (this.calculatedLatitude == null && this.calculatedLongitude == null) { this.calculatedLatitude = new float[header.getNumDataRecords() * this.header.getNumSamplesPerBandDim().getLength()]; this.calculatedLongitude = new float[header.getNumDataRecords() * this.header.getNumSamplesPerBandDim().getLength()]; GeolocateOLS.geolocateOLS(satID, 0, header.getNumDataRecords(), this.cachedScannerOffset, this.cachedSatEphemLatitude, this.cachedSatEphemLongitude,
this.readHeaderFromFile( raFile ); this.handleFileInformation(); this.handleProcessingInformation(); this.handleSatelliteInformation(); this.handleOrbitInformation(); this.handleSensorInformation(); this.handleQCInformation();
this.header = new DMSPHeader(); this.header.read(this.raf, this.ncfile); nonScanDimList.add(this.header.getNumDataRecordsDim()); scanDimList.add(this.header.getNumDataRecordsDim()); scanDimList.add(this.header.getNumSamplesPerBandDim()); } else if (curVariable.getShortName().equals("time")) { curVariable.addAttribute(new Attribute("calculatedVariable", "Using the satellite epoch for each scan.")); this.startDateString = this.header.getStartDateAtt().getStringValue(); try { this.startDate = DMSPHeader.DateFormatHandler.ISO_DATE_TIME.getDateFromDateTimeString(this.startDateString);
v2.getShortName().equals(VariableInfo.LONGITUDE.getName())) { if (this.calculatedLatitude == null && this.calculatedLongitude == null) { this.calculatedLatitude = new float[header.getNumDataRecords() * this.header.getNumSamplesPerBandDim().getLength()]; this.calculatedLongitude = new float[header.getNumDataRecords() * this.header.getNumSamplesPerBandDim().getLength()]; GeolocateOLS.geolocateOLS(satID, 0, header.getNumDataRecords(), this.cachedScannerOffset, this.cachedSatEphemLatitude, this.cachedSatEphemLongitude,
this.readHeaderFromFile( raFile ); this.handleFileInformation(); this.handleProcessingInformation(); this.handleSatelliteInformation(); this.handleOrbitInformation(); this.handleSensorInformation(); this.handleQCInformation();
Object readByteArray2D(int offsetInRecord, int numElementsInRecord) throws IOException { byte[] array = new byte[header.getNumDataRecords() * numElementsInRecord]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.read(array, i * numElementsInRecord, numElementsInRecord); this.raf.skipBytes(header.getRecordSizeInBytes() - numElementsInRecord); } return (array); }
/** Check basic DMSP file validity of given random access file. */ boolean isValidFile( ucar.unidata.io.RandomAccessFile raFile ) { // @todo This method should not be called if read() has or will be called on this instance. this.raFile = raFile; try { this.actualSize = raFile.length(); } catch ( IOException e ) { return( false ); } try { this.readHeaderFromFile( raFile ); this.handleFileInformation(); this.handleProcessingInformation(); this.handleSatelliteInformation(); this.handleSensorInformation(); } catch ( IOException e ) { return( false ); } return( true ); }
this.header = new DMSPHeader(); this.header.read(this.raf, this.ncfile); nonScanDimList.add(this.header.getNumDataRecordsDim()); scanDimList.add(this.header.getNumDataRecordsDim()); scanDimList.add(this.header.getNumSamplesPerBandDim()); } else if (curVariable.getShortName().equals("time")) { curVariable.addAttribute(new Attribute("calculatedVariable", "Using the satellite epoch for each scan.")); this.startDateString = this.header.getStartDateAtt().getStringValue(); try { this.startDate = DMSPHeader.DateFormatHandler.ISO_DATE_TIME.getDateFromDateTimeString(this.startDateString);
public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) { DMSPHeader localHeader = new DMSPHeader(); return (localHeader.isValidFile(raf)); }
v2.getShortName().equals(VariableInfo.LONGITUDE.getName())) { if (this.calculatedLatitude == null && this.calculatedLongitude == null) { this.calculatedLatitude = new float[header.getNumDataRecords() * this.header.getNumSamplesPerBandDim().getLength()]; this.calculatedLongitude = new float[header.getNumDataRecords() * this.header.getNumSamplesPerBandDim().getLength()]; GeolocateOLS.geolocateOLS(satID, 0, header.getNumDataRecords(), this.cachedScannerOffset, this.cachedSatEphemLatitude, this.cachedSatEphemLongitude,
Object readIntArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 4; int[] array = new int[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readInt(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
/** Check basic DMSP file validity of given random access file. */ boolean isValidFile( ucar.unidata.io.RandomAccessFile raFile ) { // @todo This method should not be called if read() has or will be called on this instance. this.raFile = raFile; try { this.actualSize = raFile.length(); } catch ( IOException e ) { return( false ); } try { this.readHeaderFromFile( raFile ); this.handleFileInformation(); this.handleProcessingInformation(); this.handleSatelliteInformation(); this.handleSensorInformation(); } catch ( IOException e ) { return( false ); } return( true ); }
public boolean isValidFile(ucar.unidata.io.RandomAccessFile raf) { DMSPHeader localHeader = new DMSPHeader(); return (localHeader.isValidFile(raf)); }
Object readDoubleArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 8; double[] array = new double[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readDouble(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }
Object readDoubleArray1D(int offsetInRecord) throws IOException { int elementSizeInBytes = 8; double[] array = new double[header.getNumDataRecords()]; this.raf.seek(header.getRecordSizeInBytes() * header.getNumHeaderRecords() + offsetInRecord); for (int i = 0; i < header.getNumDataRecords(); i++) { this.raf.readDouble(array, i, 1); this.raf.skipBytes(header.getRecordSizeInBytes() - elementSizeInBytes); } return (array); }