Class HydrophoneImport

java.lang.Object
PamView.importData.DataImport<Hydrophone>
Array.importHydrophoneData.HydrophoneImport

public class HydrophoneImport extends DataImport<Hydrophone>
Class for importing hydrophone data from external file and saving to database.

.csv import formats

List Format: One hydrophone data unit per row (rows have ten columns). Format is: [0]=timeExcelSerial [1]=x [2]=y [3]=z [4]=xErr [5]=yErr [6]=zErr [7]=streamerId [8]=hydrophoneId [9]=sensitivity [10]=gain . Note that sensitivity and gain info doesn't need to be included.

2D List Format (Legacy) Multiple hydrophones per row. Each row of the input array must have the following format. timeExcelSerial, x0, y0,z0, x0Error, y0Error, z0Error,x1, y1,z1, x1Error, y1Error, z1Error,,..... and so on depending on the number of hydrophones.

.mat format Not yet implemented.

Author:
Jamie Macaulay
  • Field Details

    • defaultStreamerID

      public static int defaultStreamerID
      Streamer id to use if imported data has no streamer id info
    • MATLAB_STRUCT_FORMAT

      public static final int MATLAB_STRUCT_FORMAT
      NOT IMPLEMENTED YET************* Loads from a matlab structure with following format structure(i).time =time structure(i).hydrophones= Npositionsx3 array structure(i).hydrophoneErrors= Npositionsx3 array
      See Also:
    • DATA_OK

      public static final int DATA_OK
      Everything seems fine
      See Also:
    • ERROR_YEARS

      public static final int ERROR_YEARS
      The data is far in the past or in the future
      See Also:
    • ERROR_LOADING_CSV

      public static final int ERROR_LOADING_CSV
      Something has gone wrong getting the csv file
      See Also:
    • ERROR_LOADING_MATLAB_STRUCT

      public static final int ERROR_LOADING_MATLAB_STRUCT
      Something has gone wrong loading the matlab structure
      See Also:
    • ERROR_NUMBER_OF_HYDROPHONES_ARRAY

      public static final int ERROR_NUMBER_OF_HYDROPHONES_ARRAY
      The number of hydrophones is not the same as the number of hydrophones in the current array manager.
      See Also:
    • ERROR_NUMBER_OF_HYDROPHONES_INCONSISTANT

      public static final int ERROR_NUMBER_OF_HYDROPHONES_INCONSISTANT
      The number of hydrophones is different for different times.
      See Also:
  • Constructor Details

  • Method Details

    • loadDataIntermediate

      public ArrayList loadDataIntermediate(String filePath)
      Description copied from class: DataImport
      Loads the file into memory - each element of the output array list is then processed.
      Specified by:
      loadDataIntermediate in class DataImport<Hydrophone>
      Parameters:
      filePath - - the filepath.
      Returns:
      a list of imported objects.
    • convertToHydrophoneList

      public ArrayList<Hydrophone> convertToHydrophoneList(ArrayList<ArrayList<Double>> importData)
      Converts a 2D List of hydrophones into a 1D list of hydrophone objecys.
      Parameters:
      importData - . Each row of the input array must have the following format. time, x0, y0,z0, x0Error, y0Error, z0Error,x1, y1,z1, x1Error, y1Error, z1Error,,..... and so on depending on the number of hydrophones.
      Returns:
      a list of hydrophone objects.
    • getExtensionsStrings

      public String[] getExtensionsStrings()
      Description copied from class: DataImport
      Return the file extensions that can be loaded.
      Specified by:
      getExtensionsStrings in class DataImport<Hydrophone>
      Returns:
      an array of file extensions that can be loaded.
    • isDataFormatOK

      public boolean isDataFormatOK(Hydrophone hydrophone)
      Description copied from class: DataImport
      Check that a row of imported data is in the correct format.
      Specified by:
      isDataFormatOK in class DataImport<Hydrophone>
      Parameters:
      hydrophone - -a row of data loaded from file
      Returns:
      true if the format is OK.
    • createDataUnit

      public PamDataUnit createDataUnit(Hydrophone hydrophone)
      For hydrophone data imported [0]=timeMilliss [1]=x [2]=y [3]=z [4]=xErr [5]=yErr [6]=zErr [7]=streamerId [8]=hydrophoneId [9]=sensitivity [10]=gain
      Specified by:
      createDataUnit in class DataImport<Hydrophone>
      Parameters:
      hydrophone - -a row of data loaded from file
      Returns:
      a data unit to be saved to the datablock.
    • getDataBlock

      public PamDataBlock getDataBlock()
      Description copied from class: DataImport
      Get the data block to to save data to.
      Specified by:
      getDataBlock in class DataImport<Hydrophone>
      Returns:
    • getDataUnitName

      public String getDataUnitName()
      Description copied from class: DataImport
      The name of the data unit to appear on the dialog boxes.
      Overrides:
      getDataUnitName in class DataImport<Hydrophone>
      Returns:
      name of the data unit to be imported.
    • main

      public static void main(String[] args)