ocmw.dataman.ww3WavesMatchUpDatabase module

Tools for generating an SQLite matchup database from a set of model extracts and an archive of wavebuoy data.

These tools are tied to the ResourceCode WaveWatch III model hindcast data, but the undelying functions for opening, populating and querying and SQLite dataase are generic.

db_match_to_csv

Writes database match-ups based on location and time query to a CSV file.

create_connection

Create a database connection to the SQLite database specified by db_file.

close_database

Release connection to database.

create_rscd_table

Create the ResourceCode hindcast database table.

create_buoy_table

Create the wavebuoy database table.

insert_rscd_records

Create a new record in the rscd_files table

insert_buoy_records

Create a new record in the rscd_files table

get_match_records

Get database match-up records based on supplied sql query.

insert_match_record

Create a new record in the match_files table

load_rscd_archive

Loop across the ResourceCode WW3 hindcast data archive extracting metadata and adding records to database.

load_buoy_archive

Loop across the buoy data archive extracting metadata and adding records to database.

construct_rscd_mdb

Construct the ResourceCode Match-up Database.

Tools for generating an SQLite matchup database from a set of model extracts and an archive of wavebuoy data.

These tools are tied to the ResourceCode WaveWatch III model hindcast data, but the undelying functions for opening, populating and querying and SQLite dataase are generic.

ocmw.dataman.ww3WavesMatchUpDatabase.db_match_to_csv(db_path, db_name, csv_path, csv_fname)[source]

Writes database match-ups based on location and time query to a CSV file.

ocmw.dataman.ww3WavesMatchUpDatabase.create_connection(db_file)[source]

Create a database connection to the SQLite database specified by db_file.

Parameters:

db_file – database file

Returns:

Connection object or None

ocmw.dataman.ww3WavesMatchUpDatabase.close_database(db_conn)[source]

Release connection to database.

ocmw.dataman.ww3WavesMatchUpDatabase.create_rscd_table(db_conn)[source]

Create the ResourceCode hindcast database table.

ocmw.dataman.ww3WavesMatchUpDatabase.create_buoy_table(db_conn)[source]

Create the wavebuoy database table.

ocmw.dataman.ww3WavesMatchUpDatabase.insert_rscd_records(db_conn, records)[source]

Create a new record in the rscd_files table

Parameters:
  • db_conn

  • records

Returns:

row count

ocmw.dataman.ww3WavesMatchUpDatabase.insert_buoy_records(db_conn, records)[source]

Create a new record in the rscd_files table

Parameters:
  • db_conn

  • record

Returns:

row count

ocmw.dataman.ww3WavesMatchUpDatabase.get_match_records(db_path, db_name, sql_query)[source]

Get database match-up records based on supplied sql query.

ocmw.dataman.ww3WavesMatchUpDatabase.insert_match_record(db_conn, records)[source]

Create a new record in the match_files table

Parameters:
  • db_conn

  • records

Returns:

row count

ocmw.dataman.ww3WavesMatchUpDatabase.load_rscd_archive(db_conn, archivePath, dataSet, chunkSize=500)[source]

Loop across the ResourceCode WW3 hindcast data archive extracting metadata and adding records to database.

ocmw.dataman.ww3WavesMatchUpDatabase.load_buoy_archive(db_conn, archivePath: str, dataSet: str, dataFmt: str, recFilter=None, chunkSize=500, verbose=False)[source]

Loop across the buoy data archive extracting metadata and adding records to database.

ocmw.dataman.ww3WavesMatchUpDatabase.construct_rscd_mdb(db_path: str, db_name: str, rscdpath: str, rscddataset: str, months: list, buoypath: str, buoydataset: str, buoydatafmt: str, bfilt=None, chunkSize=500)[source]

Construct the ResourceCode Match-up Database.