test_class.file: vortex-api/src/test/java/mil/army/usace/hec/vortex/io/NetcdfDataReaderTest.java
test_class.identifier: NetcdfDataReaderTest
test_case.body: @Disabled
      @Test
      void CmipPrecipImport(){
          String inFile = new File("D:/data/CMIP/Extraction_pr.nc").toString();
  
          DataReader reader = DataReader.builder()
                  .path(inFile)
                  .variable("pr")
                  .build();
  
          VortexData vortexData = reader.getDto(0);
          VortexGrid vortexGrid = (VortexGrid) vortexData;
          float[] data = vortexGrid.data();
  
          List<Double> values = new ArrayList<>();
          for (int i = 1; i < data.length; i++) {
              if (!Float.isNaN(data[i])) {
                  values.add((double) data[i]);
              }
          }
  
          double max = Collections.max(values);
          double min = Collections.min(values);
  
          assertEquals(66.21134185791016, max, 1E-5);
          assertEquals(0.04108993336558342, min, 1E-5);
      }
test_case.class_method_signature: NetcdfDataReaderTest.CmipPrecipImport()
test_case.full_signature: @Disabled @Test void CmipPrecipImport()
test_case.identifier: CmipPrecipImport
test_case.invocations: toString build variable path builder getDto data isNaN add max min assertEquals assertEquals
test_case.modifiers: @Disabled @Test
test_case.parameters: ()
test_case.return: void
test_case.signature: void CmipPrecipImport()
focal_class.declarator: logger = Logger.getLogger(NetcdfDataReader.class.getName())
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = Logger.getLogger(NetcdfDataReader.class.getName());
focal_class.type: Logger
focal_class.var_name: logger
focal_class.file: vortex-api/src/main/java/mil/army/usace/hec/vortex/io/NetcdfDataReader.java
focal_class.identifier: NetcdfDataReader
focal_class.class_method_signature: NetcdfDataReader.NetcdfDataReader(DataReaderBuilder builder)
focal_class.full_signature:   NetcdfDataReader(DataReaderBuilder builder)
focal_class.identifier: NetcdfDataReader
focal_class.parameters: (DataReaderBuilder builder)
focal_class.signature:  NetcdfDataReader(DataReaderBuilder builder)
focal_class.class_method_signature: NetcdfDataReader.getDtos()
focal_class.full_signature: @Override public List<VortexData> getDtos()
focal_class.identifier: getDtos
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<VortexData>
focal_class.signature: List<VortexData> getDtos()
focal_class.class_method_signature: NetcdfDataReader.getDto(int idx)
focal_class.full_signature: @Override public VortexData getDto(int idx)
focal_class.identifier: getDto
focal_class.modifiers: @Override public
focal_class.parameters: (int idx)
focal_class.return: VortexData
focal_class.signature: VortexData getDto(int idx)
focal_class.class_method_signature: NetcdfDataReader.getDtoCount()
focal_class.full_signature: @Override public int getDtoCount()
focal_class.identifier: getDtoCount
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getDtoCount()
focal_class.class_method_signature: NetcdfDataReader.getVariables(String path)
focal_class.full_signature: public static Set<String> getVariables(String path)
focal_class.identifier: getVariables
focal_class.modifiers: public static
focal_class.parameters: (String path)
focal_class.return: Set<String>
focal_class.signature: Set<String> getVariables(String path)
focal_class.class_method_signature: NetcdfDataReader.getFloatArray(Array array)
focal_class.full_signature: private float[] getFloatArray(Array array)
focal_class.identifier: getFloatArray
focal_class.modifiers: private
focal_class.parameters: (Array array)
focal_class.return: float[]
focal_class.signature: float[] getFloatArray(Array array)
focal_class.class_method_signature: NetcdfDataReader.getData(GridDataset dataset, String variable)
focal_class.full_signature: private List<VortexData> getData(GridDataset dataset, String variable)
focal_class.identifier: getData
focal_class.modifiers: private
focal_class.parameters: (GridDataset dataset, String variable)
focal_class.return: List<VortexData>
focal_class.signature: List<VortexData> getData(GridDataset dataset, String variable)
focal_class.class_method_signature: NetcdfDataReader.getWkt(Projection projection)
focal_class.full_signature: private static String getWkt(Projection projection)
focal_class.identifier: getWkt
focal_class.modifiers: private static
focal_class.parameters: (Projection projection)
focal_class.return: String
focal_class.signature: String getWkt(Projection projection)
focal_class.class_method_signature: NetcdfDataReader.getTimeBounds(GridCoordSystem gcs)
focal_class.full_signature: private List<ZonedDateTime[]> getTimeBounds(GridCoordSystem gcs)
focal_class.identifier: getTimeBounds
focal_class.modifiers: private
focal_class.parameters: (GridCoordSystem gcs)
focal_class.return: List<ZonedDateTime[]>
focal_class.signature: List<ZonedDateTime[]> getTimeBounds(GridCoordSystem gcs)
focal_class.class_method_signature: NetcdfDataReader.convert(CalendarDate date)
focal_class.full_signature: private static ZonedDateTime convert(CalendarDate date)
focal_class.identifier: convert
focal_class.modifiers: private static
focal_class.parameters: (CalendarDate date)
focal_class.return: ZonedDateTime
focal_class.signature: ZonedDateTime convert(CalendarDate date)
focal_class.class_method_signature: NetcdfDataReader.getGrid(GridCoordSystem coordinateSystem)
focal_class.full_signature: private static Grid getGrid(GridCoordSystem coordinateSystem)
focal_class.identifier: getGrid
focal_class.modifiers: private static
focal_class.parameters: (GridCoordSystem coordinateSystem)
focal_class.return: Grid
focal_class.signature: Grid getGrid(GridCoordSystem coordinateSystem)
focal_class.class_method_signature: NetcdfDataReader.shiftGrid(Grid grid)
focal_class.full_signature: private static Grid shiftGrid(Grid grid)
focal_class.identifier: shiftGrid
focal_class.modifiers: private static
focal_class.parameters: (Grid grid)
focal_class.return: Grid
focal_class.signature: Grid shiftGrid(Grid grid)
focal_class.class_method_signature: NetcdfDataReader.scaleGrid(Grid grid, Unit<?> cellUnits, Unit<?> csUnits)
focal_class.full_signature: private static Grid scaleGrid(Grid grid, Unit<?> cellUnits, Unit<?> csUnits)
focal_class.identifier: scaleGrid
focal_class.modifiers: private static
focal_class.parameters: (Grid grid, Unit<?> cellUnits, Unit<?> csUnits)
focal_class.return: Grid
focal_class.signature: Grid scaleGrid(Grid grid, Unit<?> cellUnits, Unit<?> csUnits)
focal_class.class_method_signature: NetcdfDataReader.getDtoCount(GridDataset dataset, String variable)
focal_class.full_signature: private int getDtoCount(GridDataset dataset, String variable)
focal_class.identifier: getDtoCount
focal_class.modifiers: private
focal_class.parameters: (GridDataset dataset, String variable)
focal_class.return: int
focal_class.signature: int getDtoCount(GridDataset dataset, String variable)
focal_class.class_method_signature: NetcdfDataReader.getDtoCount(VariableDS variableDS)
focal_class.full_signature: private int getDtoCount(VariableDS variableDS)
focal_class.identifier: getDtoCount
focal_class.modifiers: private
focal_class.parameters: (VariableDS variableDS)
focal_class.return: int
focal_class.signature: int getDtoCount(VariableDS variableDS)
focal_class.class_method_signature: NetcdfDataReader.getData(GridDataset dataset, String variable, int idx)
focal_class.full_signature: private VortexData getData(GridDataset dataset, String variable, int idx)
focal_class.identifier: getData
focal_class.modifiers: private
focal_class.parameters: (GridDataset dataset, String variable, int idx)
focal_class.return: VortexData
focal_class.signature: VortexData getData(GridDataset dataset, String variable, int idx)
focal_class.superclass: extends DataReader
focal_method.body: @Override
      public VortexData getDto(int idx) {
          try (NetcdfDataset ncd = NetcdfDatasets.openDataset(path);  Formatter errlog = new Formatter()) {
              FeatureDataset dataset = FeatureDatasetFactoryManager.wrap(FeatureType.GRID, ncd, null, errlog);
              if (dataset != null) {
                  FeatureType ftype = dataset.getFeatureType();
                  if (ftype == FeatureType.GRID) {
                      assert (dataset instanceof GridDataset);
                      GridDataset gridDataset = (GridDataset) dataset;
                      return getData(gridDataset, variableName, idx);
                  }
              } else {
                  List<Variable> variables = ncd.getVariables();
                  for (Variable variable : variables){
                      if (variable.getShortName().equals(variableName) && variable instanceof VariableDS) {
                          VariableDS variableDS = (VariableDS) variable;
                          List<CoordinateSystem> coordinateSystems = variableDS.getCoordinateSystems();
                          if (!coordinateSystems.isEmpty()) {
                              VariableDsReader reader = VariableDsReader.builder()
                                      .setNetcdfFile(ncd)
                                      .setVariableName(variableName)
                                      .build();
  
                              return reader.read(idx);
                          }
                      }
                  }
              }
          } catch (IOException e) {
              logger.log(Level.SEVERE, e, e::getMessage);
          }
  
          return null;
      }
focal_method.class_method_signature: NetcdfDataReader.getDto(int idx)
focal_method.full_signature: @Override public VortexData getDto(int idx)
focal_method.identifier: getDto
focal_method.invocations: openDataset wrap getFeatureType getData getVariables equals getShortName getCoordinateSystems isEmpty build setVariableName setNetcdfFile builder read log
focal_method.modifiers: @Override public
focal_method.parameters: (int idx)
focal_method.return: VortexData
focal_method.signature: VortexData getDto(int idx)