Class SerNetCDFUtils
java.lang.Object
org.apache.sedona.core.formatMapper.netcdfParser.SerNetCDFUtils
- All Implemented Interfaces:
Serializable
The Class SerNetCDFUtils.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DoublegetDataAsym(ucar.ma2.Array array, int i, int j, int offset, int increment) Gets the data from asymmetric mapping.static DoublegetDataSym(ucar.ma2.Array array, int i, int j) Gets the data from symmetric mapping.static IntegergetDimensionSize(ucar.nc2.dataset.NetcdfDataset netcdfFile, String rowDim) Gets the size of a dimension of a NetCDF file.static ucar.ma2.ArraygetNetCDF2DArray(ucar.nc2.dataset.NetcdfDataset netcdfFile, String variable) Extracts a variable's data from a NetCDF.static ucar.nc2.dataset.NetcdfDatasetloadDFSNetCDFDataSet(String dfsUri, String location, Integer bufferSize) Loads a NetCDF Dataset from HDFS.static ucar.nc2.dataset.NetcdfDatasetloadNetCDFDataSet(String url) Loads a NetCDF Dataset from a URL.
-
Constructor Details
-
SerNetCDFUtils
public SerNetCDFUtils()
-
-
Method Details
-
getNetCDF2DArray
public static ucar.ma2.Array getNetCDF2DArray(ucar.nc2.dataset.NetcdfDataset netcdfFile, String variable) Extracts a variable's data from a NetCDF.If the variable is not found then an Array with the element 0.0 is returned with shape (1,1). Note that all dimensions of size 1 are eliminated. For example the array shape (21, 5, 1, 2) is reduced to (21, 5, 2) since the 3rd dimension only ranges over a single value.
- Parameters:
netcdfFile- The NetCDF file.variable- The variable whose data we want to extract.- Returns:
- 2D Data array.
-
getDataAsym
Gets the data from asymmetric mapping. One geolocation maps more than one observation. Or, one observation maps more than one geolocation.- Parameters:
array- the arrayi- the ij- the joffset- the offsetincrement- the increment- Returns:
- the data asym
-
getDataSym
Gets the data from symmetric mapping. One geolocation maps one observation.- Parameters:
array- the arrayi- the ij- the j- Returns:
- the data sym
-
loadNetCDFDataSet
Loads a NetCDF Dataset from a URL.- Parameters:
url- the url- Returns:
- the netcdf dataset
-
loadDFSNetCDFDataSet
public static ucar.nc2.dataset.NetcdfDataset loadDFSNetCDFDataSet(String dfsUri, String location, Integer bufferSize) Loads a NetCDF Dataset from HDFS.- Parameters:
dfsUri- HDFS URI(eg. hdfs://master:9000/)location- File path on HDFSbufferSize- The size of the buffer to be used- Returns:
- the netcdf dataset
-
getDimensionSize
Gets the size of a dimension of a NetCDF file.- Parameters:
netcdfFile- the netcdf filerowDim- the row dim- Returns:
- the dimension size
-