MatchUpDatabase

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.

Dependencies [External]:

os, re, sqlite, csv

Dependencies [Internal]:

waveval.Geomtery, waveval.TimeFuncs, waveval.ObsData, waveval.ModelData

MatchUpDatabase.close_database(db_conn)[source]
MatchUpDatabase.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]
MatchUpDatabase.create_buoy_table(db_conn)[source]
MatchUpDatabase.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

MatchUpDatabase.create_database(db_path, db_name)[source]
MatchUpDatabase.create_match_table(db_conn)[source]
MatchUpDatabase.create_rscd_table(db_conn)[source]
MatchUpDatabase.csv2tuples(csv_file)[source]
MatchUpDatabase.db_match_to_csv(db_path, db_name, csv_path, csv_fname)[source]
MatchUpDatabase.getPlatformList(records)[source]
MatchUpDatabase.getPlatformRecords(records, platform)[source]
MatchUpDatabase.get_match_records(db_path, db_name, sql_query)[source]
MatchUpDatabase.insert_buoy_records(db_conn, records)[source]

Create a new record in the rscd_files table

Parameters:
  • db_conn

  • record

Returns:

row count

MatchUpDatabase.insert_match_record(db_conn, records)[source]

Create a new record in the match_files table

Parameters:
  • db_conn

  • records

Returns:

row count

MatchUpDatabase.insert_rscd_records(db_conn, records)[source]

Create a new record in the rscd_files table

Parameters:
  • db_conn

  • records

Returns:

row count

MatchUpDatabase.load_buoy_archive(db_conn, archivePath: str, dataSet: str, dataFmt: str, recFilter=None, chunkSize=500, verbose=False)[source]
MatchUpDatabase.load_rscd_archive(db_conn, archivePath, dataSet, chunkSize=500)[source]
MatchUpDatabase.mapRecord(startYr, stopYr, record, dataset)[source]
class MatchUpDatabase.recordFilter(coverage: list)[source]

Bases: object

includeRecord(record, verbose=False)[source]
MatchUpDatabase.touch(path)[source]
MatchUpDatabase.tuples2csv(records, csv_file)[source]