Package ucar.nc2.ft.point.writer
Class CFPointWriter
- java.lang.Object
-
- ucar.nc2.ft.point.writer.CFPointWriter
-
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
WriterCFPointCollection,WriterCFProfileCollection,WriterCFStationCollection,WriterCFStationProfileCollection,WriterCFTrajectoryCollection,WriterCFTrajectoryProfileCollection
public abstract class CFPointWriter extends Object implements Closeable
Write Point Feature Collections into netcdf3/4 files in CF 1.9 point obs conventions.- netcdf3: use indexed ragged array representation
-
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description protectedCFPointWriter(String fileOut, List<Attribute> atts, List<VariableSimpleIF> dataVars, CFPointWriterConfig config, List<CoordinateAxis> coords)protectedCFPointWriter(String fileOut, List<Attribute> atts, List<VariableSimpleIF> dataVars, CalendarDateUnit timeUnit, String altUnits, CFPointWriterConfig config)CtorprotectedCFPointWriter(String fileOut, List<Attribute> atts, NetcdfFileWriter.Version version)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddCoordinatesClassic(Dimension recordDim, List<VariableSimpleIF> coords, Map<String,Variable> varMap)protected voidaddCoordinatesExtended(Structure parent, List<VariableSimpleIF> coords)protected voidaddDataVariablesClassic(Dimension recordDim, StructureData stnData, Map<String,Variable> varMap, String coordVars)protected voidaddDataVariablesExtended(StructureData obsData, String coordVars)protected voidaddDimensionsClassic(List<? extends VariableSimpleIF> vars, Map<String,Dimension> dimMap)protected voidaddExtraVariables()voidclose()voidfinish()protected VariableSimpleIFgetDataVar(String name)static StringgetSharedDimName(Dimension dim)Returns a name fordimthat is suitable for a shared dimension.static voidmain(String[] args)protected List<Dimension>makeDimensionList(Map<String,Dimension> dimMap, List<Dimension> oldDims)protected abstract voidmakeFeatureVariables(List<StructureData> featureData, boolean isExtended)protected voidmakeMiddleVariables(List<StructureData> middleData, boolean isExtended)voidsetFeatureAuxInfo(int nfeatures, int id_strlen)protected voidtrackBB(LatLonPoint loc, CalendarDate obsDate)protected voidwriteExtraVariables()static intwriteFeatureCollection(FeatureDatasetPoint fdpoint, String fileOut, CFPointWriterConfig config)Write a FeatureDatasetPoint to a netcd3/4 file.static intwriteFeatureCollection(FeatureDatasetPoint fdpoint, String fileOut, NetcdfFileWriter.Version version)protected voidwriteHeader(List<VariableSimpleIF> obsCoords, List<? extends PointFeatureCollection> stationFeatures, List<StructureData> featureDataStructs, List<StructureData> middleDataStructs)protected voidwriteHeader(List<VariableSimpleIF> obsCoords, List<StructureData> featureData, StructureData obsData, String coordNames)protected intwriteStructureData(int recno, Structure s, StructureData sdata, Map<String,Variable> varMap)protected intwriteStructureDataClassic(Map<String,Variable> varMap, int[] origin, StructureData sdata)
-
-
-
Field Detail
-
recordName
public static final String recordName
- See Also:
- Constant Field Values
-
recordDimName
public static final String recordDimName
- See Also:
- Constant Field Values
-
latName
public static final String latName
- See Also:
- Constant Field Values
-
lonName
public static final String lonName
- See Also:
- Constant Field Values
-
altName
public static String altName
-
timeName
public static String timeName
-
stationStructName
public static final String stationStructName
- See Also:
- Constant Field Values
-
stationDimName
public static final String stationDimName
- See Also:
- Constant Field Values
-
stationIdName
public static final String stationIdName
- See Also:
- Constant Field Values
-
stationAltName
public static final String stationAltName
- See Also:
- Constant Field Values
-
descName
public static final String descName
- See Also:
- Constant Field Values
-
wmoName
public static final String wmoName
- See Also:
- Constant Field Values
-
stationIndexName
public static final String stationIndexName
- See Also:
- Constant Field Values
-
profileStructName
public static final String profileStructName
- See Also:
- Constant Field Values
-
profileDimName
public static final String profileDimName
- See Also:
- Constant Field Values
-
profileIdName
public static final String profileIdName
- See Also:
- Constant Field Values
-
numberOfObsName
public static final String numberOfObsName
- See Also:
- Constant Field Values
-
profileTimeName
public static final String profileTimeName
- See Also:
- Constant Field Values
-
trajStructName
public static final String trajStructName
- See Also:
- Constant Field Values
-
trajDimName
public static final String trajDimName
- See Also:
- Constant Field Values
-
trajIdName
public static final String trajIdName
- See Also:
- Constant Field Values
-
idMissingValue
public static final int idMissingValue
- See Also:
- Constant Field Values
-
config
protected final CFPointWriterConfig config
-
writer
protected NetcdfFileWriter writer
-
timeUnit
protected CalendarDateUnit timeUnit
-
altUnits
protected String altUnits
-
altitudeCoordinateName
protected String altitudeCoordinateName
-
isExtendedModel
protected final boolean isExtendedModel
-
useAlt
protected boolean useAlt
-
nfeatures
protected int nfeatures
-
id_strlen
protected int id_strlen
-
record
protected Structure record
-
recordDim
protected Dimension recordDim
-
dataVars
protected List<VariableSimpleIF> dataVars
-
coordVars
protected List<CoordinateAxis> coordVars
-
llbb
protected LatLonRect llbb
-
minDate
protected CalendarDate minDate
-
maxDate
protected CalendarDate maxDate
-
-
Constructor Detail
-
CFPointWriter
protected CFPointWriter(String fileOut, List<Attribute> atts, NetcdfFileWriter.Version version) throws IOException
- Throws:
IOException
-
CFPointWriter
protected CFPointWriter(String fileOut, List<Attribute> atts, List<VariableSimpleIF> dataVars, CalendarDateUnit timeUnit, String altUnits, CFPointWriterConfig config) throws IOException
Ctor- Parameters:
fileOut- name of the output fileatts- global attributes to be addedconfig- configure- Throws:
IOException
-
CFPointWriter
protected CFPointWriter(String fileOut, List<Attribute> atts, List<VariableSimpleIF> dataVars, CFPointWriterConfig config, List<CoordinateAxis> coords) throws IOException
- Throws:
IOException
-
-
Method Detail
-
writeFeatureCollection
public static int writeFeatureCollection(FeatureDatasetPoint fdpoint, String fileOut, NetcdfFileWriter.Version version) throws IOException
- Throws:
IOException
-
writeFeatureCollection
public static int writeFeatureCollection(FeatureDatasetPoint fdpoint, String fileOut, CFPointWriterConfig config) throws IOException
Write a FeatureDatasetPoint to a netcd3/4 file.- Parameters:
fdpoint- the FeatureDatasetPoint; do first FeatureCollection contained within.fileOut- write to this fileconfig- configuration- Returns:
- count of number of pointFeatures written.
- Throws:
IOException
-
setFeatureAuxInfo
public void setFeatureAuxInfo(int nfeatures, int id_strlen)
-
getDataVar
protected VariableSimpleIF getDataVar(String name)
-
makeFeatureVariables
protected abstract void makeFeatureVariables(List<StructureData> featureData, boolean isExtended)
-
makeMiddleVariables
protected void makeMiddleVariables(List<StructureData> middleData, boolean isExtended)
-
writeHeader
protected void writeHeader(List<VariableSimpleIF> obsCoords, List<? extends PointFeatureCollection> stationFeatures, List<StructureData> featureDataStructs, List<StructureData> middleDataStructs) throws IOException
- Throws:
IOException
-
writeHeader
protected void writeHeader(List<VariableSimpleIF> obsCoords, List<StructureData> featureData, StructureData obsData, String coordNames) throws IOException
- Throws:
IOException
-
addExtraVariables
protected void addExtraVariables()
-
writeExtraVariables
protected void writeExtraVariables() throws IOException- Throws:
IOException
-
addCoordinatesClassic
protected void addCoordinatesClassic(Dimension recordDim, List<VariableSimpleIF> coords, Map<String,Variable> varMap)
-
addCoordinatesExtended
protected void addCoordinatesExtended(Structure parent, List<VariableSimpleIF> coords)
-
addDataVariablesClassic
protected void addDataVariablesClassic(Dimension recordDim, StructureData stnData, Map<String,Variable> varMap, String coordVars)
-
addDataVariablesExtended
protected void addDataVariablesExtended(StructureData obsData, String coordVars)
-
addDimensionsClassic
protected void addDimensionsClassic(List<? extends VariableSimpleIF> vars, Map<String,Dimension> dimMap)
-
makeDimensionList
protected List<Dimension> makeDimensionList(Map<String,Dimension> dimMap, List<Dimension> oldDims)
-
getSharedDimName
public static String getSharedDimName(Dimension dim)
Returns a name fordimthat is suitable for a shared dimension. If the dimension is anonymous, meaning that its name isnull, we return a default name:"len" + dim.getLength(). Otherwise, we return the dimension's existing name.- Parameters:
dim- a dimension.- Returns:
- a name that is suitable for a shared dimension, i.e. not
null.
-
writeStructureData
protected int writeStructureData(int recno, Structure s, StructureData sdata, Map<String,Variable> varMap) throws IOException- Throws:
IOException
-
writeStructureDataClassic
protected int writeStructureDataClassic(Map<String,Variable> varMap, int[] origin, StructureData sdata) throws IOException, InvalidRangeException
- Throws:
IOExceptionInvalidRangeException
-
trackBB
protected void trackBB(LatLonPoint loc, CalendarDate obsDate)
-
finish
public void finish() throws IOException- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
-