Package ucar.nc2.iosp.noaa
Class Ghcnm
- java.lang.Object
-
- ucar.nc2.iosp.AbstractIOServiceProvider
-
- ucar.nc2.iosp.noaa.Ghcnm
-
- All Implemented Interfaces:
Comparable<IOServiceProvider>
,IOServiceProvider
public class Ghcnm extends AbstractIOServiceProvider
Nomads GLOBAL HISTORICAL CLIMATOLOGY NETWORK MONTHLY (GHCNM) v3 Beta. Ascii file. Write index into .ncsx using protobug (experimental) IOSP can then recognize the ncsx file, so it can be passed into NetdfFile.open() instead of the ascii file. Otherwise you have to explicitly specify the iosp, eg:The index has list of stations and offsets into station file and data file. since the data file has one station's data grouped together, this efficiently answers "get all data for station". One could sort datafile by time, and add time index, to answer "get all data for time range". Protobuf generation: cd c:/dev/tds4.2/thredds/cdm/src/main/java protoc --proto_path=. --java_out=. ucar/nc2/iosp/noaa/GhcnmIndex.proto
LOOK probable file leaks- Since:
- Dec 8, 2010
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ucar.nc2.iosp.IOServiceProvider
IOServiceProvider.SortGroup
-
-
Field Summary
-
Fields inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
location, raf, rafOrder
-
-
Constructor Summary
Constructors Constructor Description Ghcnm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the file.String
getFileTypeDescription()
Get a human-readable description for this file type.String
getFileTypeId()
Get a unique stnId for this file type.StructureDataIterator
getStructureIterator(Structure s, int bufferSize)
Get the structure iteratorboolean
isValidFile(RandomAccessFile raf)
Check if this is a valid file for this IOServiceProvider.void
open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask)
Open existing file, and populate ncfile with it.Array
readData(Variable v2, Section section)
Returns an ArraySequence, no subsetting is allowed.-
Methods inherited from class ucar.nc2.iosp.AbstractIOServiceProvider
build, buildFinish, getDetailInfo, getFileTypeVersion, getLastModified, isBuilder, reacquire, readSection, readToByteChannel, readToOutputStream, release, sendIospMessage, setNetcdfFile, streamToByteChannel, syncExtend, toStringDebug
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface ucar.nc2.iosp.IOServiceProvider
compareTo, getSortGroup
-
-
-
-
Method Detail
-
isValidFile
public boolean isValidFile(RandomAccessFile raf) throws IOException
Description copied from interface:IOServiceProvider
Check if this is a valid file for this IOServiceProvider. You must make this method thread safe, ie dont keep any state.- Parameters:
raf
- RandomAccessFile- Returns:
- true if valid.
- Throws:
IOException
- if read error
-
close
public void close() throws IOException
Description copied from interface:IOServiceProvider
Close the file. It is the IOServiceProvider's job to close the file (even though it didnt open it), and to free any other resources it has used.- Specified by:
close
in interfaceIOServiceProvider
- Overrides:
close
in classAbstractIOServiceProvider
- Throws:
IOException
- if read error
-
open
public void open(RandomAccessFile raf, NetcdfFile ncfile, CancelTask cancelTask) throws IOException
Description copied from interface:IOServiceProvider
Open existing file, and populate ncfile with it. This method is only called by the NetcdfFile constructor on itself. The provided NetcdfFile object will be empty except for the location String and the IOServiceProvider associated with this NetcdfFile object.- Specified by:
open
in interfaceIOServiceProvider
- Overrides:
open
in classAbstractIOServiceProvider
- Parameters:
raf
- the file to work on, it has already passed the isValidFile() test.ncfile
- add objects to this empty NetcdfFilecancelTask
- used to monitor user cancellation; may be null.- Throws:
IOException
- if read error
-
getFileTypeId
public String getFileTypeId()
Get a unique stnId for this file type.- Returns:
- registered stnId of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
getFileTypeDescription
public String getFileTypeDescription()
Get a human-readable description for this file type.- Returns:
- description of the file type
- See Also:
- "https://www.unidata.ucar.edu/software/netcdf-java/formats/FileTypes.html"
-
readData
public Array readData(Variable v2, Section section) throws IOException
Returns an ArraySequence, no subsetting is allowed.- Parameters:
v2
- a top-level Variablesection
- the section of data to read. There must be a Range for each Dimension in the variable, in order. Note: no nulls allowed. IOSP may not modify.- Returns:
- ArraySequence
- Throws:
IOException
- if read error- See Also:
Range
-
getStructureIterator
public StructureDataIterator getStructureIterator(Structure s, int bufferSize) throws IOException
Get the structure iterator- Specified by:
getStructureIterator
in interfaceIOServiceProvider
- Overrides:
getStructureIterator
in classAbstractIOServiceProvider
- Parameters:
s
- the StructurebufferSize
- the buffersize- Returns:
- the data iterator
- Throws:
IOException
- if problem reading data
-
-