https://github.com/mbari-org/expd-java
Java libraries for accessing MBARI's expedition data
https://github.com/mbari-org/expd-java
Last synced: 3 months ago
JSON representation
Java libraries for accessing MBARI's expedition data
- Host: GitHub
- URL: https://github.com/mbari-org/expd-java
- Owner: mbari-org
- License: apache-2.0
- Created: 2025-10-15T17:00:31.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-10-15T19:00:45.000Z (3 months ago)
- Last Synced: 2025-10-16T15:57:15.045Z (3 months ago)
- Language: Java
- Size: 99.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Notice: NOTICE
Awesome Lists containing this project
README
# EXPD
EXPD is a Java API for simplifying access to MBARI's expedition database (also called EXPD). It uses JDBC for data access. It also contains conditional logic to allow tasks such as selecting the best available navigation data and oxygen data.
## Adding to your project
This library is available on [Maven Central](https://central.sonatype.com/artifact/org.mbari.expd/expd-jdbc).
```
org.mbari.expd
expd-jdbc
2.0.0
```
## Usage for developers
You either initialize the DAO with a connection parameters or through environment variables.
```java
import java.util.Optional;
import org.mbari.expd.jdbc.DAOFactoryImpl;
import org.mbari.expd.jdbc.JdbcParameters;
// Using connection parameters
var jdbcParams = new JdbcParameters("jdbc:mysql://localhost:3306/expd", "root", "password", Optional.of("org.mariadb.jdbc.Driver"));
DAOFactory daoFactory = new DAOFactoryImpl(jdbcParams);
// Using environment variables: set these in your shell or IDE run configuration
// export EXPD_JDBC_URL="jdbc:mysql://localhost:3306/expd"
// export EXPD_JDBC_USER="root"
// export EXPD_JDBC_PASSWORD="password"
// export EXPD_JDBC_DRIVER="org.mariadb.jdbc.Driver"
DAOFactory daoFactory = new DAOFactoryImpl(); // will use environment variables
// Use the daoFactory to get DAOs
var diveDAO = daoFactory.getDiveDAO();
```
### Examples
#### To get a list of all ROVs
```java
import org.mbari.expd.jdbc.BaseDAOImpl;
List rovs = BaseDAOImpl.getAllRovNames();
```
#### To get all dives for a particular ROV:
```java
import org.mbari.expd.DiveDAO;
import org.mbari.expd.jdbc.DiveDAOImpl;
DiveDAO dao = daoFactory.getDiveDAO();
Collection divesForRov = dao.findByPlatform(rovNameAsString);
// Example converting them to a list of dive numbers:
List diveNumbersForRov = divesForRov.stream()
.map(Dive::getDiveNumber)
.sorted()
.toList();
```
#### To get a dive object by ROV name and dive number
```java
import org.mbari.expd.DiveDAO;
import org.mbari.expd.jdbc.DiveDAOImpl;
DiveDAO dao = daoFactory.getDiveDAO();
// returns null if no match is found
Dive dive = dao.findByPlatformAndDiveNumber("Ventana", 123);
```
### To get other data for a particular dive:
#### Position
```java
// latitude, longitude, depth
import org.mbari.expd.NavigationDatum;
import org.mbari.expd.NavigationDatumDAO;
import org.mbari.expd.jdbc.NavigationDAOImpl;
// You'll need a Dive object
NavigationDAO dao = daoFactory.getNavigationDAO();
List nav = dao.fetchBestnavigationData(dive);
```
#### CTD
```java
// salinity (psu), temperature (celsius), pressure (dbar)
import org.mbari.expd.CtdDatum;
import org.mbari.expd.CtdDatumDAO;
import org.mbari.expd.jdbc.CtdDatumDAOImpl;
// You'll need a Dive object
CtdDatumDAO dao = daoFactory.getCtdDatumDAO();
List ctd = dao.fetchCtdData(dive);
```
#### Camera logs
```java
// timecode, recordedTimestamp. Useful when you're doing dive quality analysis later on
import org.mbari.expd.CameraDatum;
import org.mbari.expd.CameraDatumDAO;
import org.mbari.expd.jdbc.CameraDatumDAOImpl;
// You'll need a Dive object
CameraDatumDAO dao = daoFactory.getCameraDatumDAO();
List cam = dao.fetchCameraData(dive);
```