Class SerNetCDFUtils

java.lang.Object
org.apache.sedona.core.formatMapper.netcdfParser.SerNetCDFUtils
All Implemented Interfaces:
Serializable

public class SerNetCDFUtils extends Object implements Serializable
The Class SerNetCDFUtils.
See Also:
  • 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

      public static Double getDataAsym(ucar.ma2.Array array, int i, int j, int offset, int increment)
      Gets the data from asymmetric mapping. One geolocation maps more than one observation. Or, one observation maps more than one geolocation.
      Parameters:
      array - the array
      i - the i
      j - the j
      offset - the offset
      increment - the increment
      Returns:
      the data asym
    • getDataSym

      public static Double getDataSym(ucar.ma2.Array array, int i, int j)
      Gets the data from symmetric mapping. One geolocation maps one observation.
      Parameters:
      array - the array
      i - the i
      j - the j
      Returns:
      the data sym
    • loadNetCDFDataSet

      public static ucar.nc2.dataset.NetcdfDataset loadNetCDFDataSet(String url)
      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 HDFS
      bufferSize - The size of the buffer to be used
      Returns:
      the netcdf dataset
    • getDimensionSize

      public static Integer getDimensionSize(ucar.nc2.dataset.NetcdfDataset netcdfFile, String rowDim)
      Gets the size of a dimension of a NetCDF file.
      Parameters:
      netcdfFile - the netcdf file
      rowDim - the row dim
      Returns:
      the dimension size