Skip to content

Commit

Permalink
Add Lowell Tilt Current Meter (TCM) support (#184)
Browse files Browse the repository at this point in the history
This PR also fixes some Git LFS file issues.

* addtcm 1st commit

* add tcm 1st working test

* add spd, dir and update tests, docs

* fixes to cdir, lfs files

* restore *.txt *.yaml to git

* upadte lfs and attr
  • Loading branch information
ssuttles-usgs authored Feb 12, 2024
1 parent 59c7afe commit c747a7a
Show file tree
Hide file tree
Showing 43 changed files with 1,044 additions and 120 deletions.
18 changes: 13 additions & 5 deletions doc/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,10 @@ WXT-specific options include:
EofE ECHOLOGGER
---------------
- All the _min, _max, _bad_ens, etc. options available to the EXO.
- instrument_type: types "ea" and "aa" are supported.
- orientation: orientation of transducers types 'DOWN' or 'UP' are supported.
- average_salinity: average salinity value (PSU) for the water mass for the deployment site and time period.
- average_salinity_note: source of average salinity value.
- ``instrument_type``: types "ea" and "aa" are supported.
- ``orientation``: orientation of transducers types 'DOWN' or 'UP' are supported.
- ``average_salinity``: average salinity value (PSU) for the water mass for the deployment site and time period.
- ``average_salinity_note``: source of average salinity value.

Sequoia Scientific LISST
------------------------
Expand All @@ -190,4 +190,12 @@ Onset Hobo
- ``instrument_type``: can be ``hwl`` (water level), ``hwlb`` (water level as barometer), ``hdo`` (dissolved oxygen) or ``hcnd`` (conductivity) use these based on parameter measured by hobo logger
- ``skipfooter``: number of lines to skip in the CSV file at the end of the file
- ``ncols``: number of columns of data to read, starting at first
- ``names``: option for user specified column names (only recommended when code will read names using automated/default method)
- ``names``: option for user specified column names (only recommended when code will not read names using automated/default method)

Lowell TCM Hobo
----------

- All the _min, _max, _bad_ens, etc. options available to the EXO.
- ``skipfooter``: number of lines to skip in the CSV file at the end of the file
- ``ncols``: number of columns of data to read, starting at first
- ``names``: option for user specified column names (only recommended when code will not read names using automated/default method)
29 changes: 29 additions & 0 deletions doc/tcm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Lowell Tilt Current Meter (TCM)
*******************************

Data will generally be processed using a series of run scripts. The first script for each instrument type
depends on two :doc:`configuration files </config>`.

Instrument data to raw .cdf
===========================

Convert from exported CSV file to a raw netCDF file with .cdf extension using ``runtcmcsv2cdf.py``.

runtcmcsv2cdf.py
-----------------

.. argparse::
:ref: stglib.core.cmd.tcmcsv2cdf_parser
:prog: runtcmcsv2cdf.py

Raw .cdf to CF-compliant .nc
============================

Convert the raw .cdf data into CF-compliant netCDF file with .nc extension using ``runtcmcdf2nc.py``.

runtcmcdf2nc.py
----------------

.. argparse::
:ref: stglib.core.cmd.tcmcdf2nc_parser
:prog: runtcmcdf2nc.py
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
"runsigcdf2nc.py=stglib.core.runcmd:runsigcdf2nc",
"runlisstcsv2cdf.py=stglib.core.runcmd:runlisstcsv2cdf",
"runlisstcdf2nc.py=stglib.core.runcmd:runlisstcdf2nc",
"runtcmcsv2cdf.py=stglib.core.runcmd:runtcmcsv2cdf",
"runtcmcdf2nc.py=stglib.core.runcmd:runtcmcdf2nc",
],
},
include_package_data=True,
Expand Down
1 change: 1 addition & 0 deletions stglib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
rdi,
rsk,
sig,
tcm,
troll,
vec,
wxt,
Expand Down
17 changes: 17 additions & 0 deletions stglib/core/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,3 +359,20 @@ def sigdlfncdf2nc_parser():
atmarg(parser)

return parser


def tcmcsv2cdf_parser():
description = "Convert Lowell Tilt Current Meter .txt file to raw .cdf format. Run this script from the directory containing TCM file."
parser = argparse.ArgumentParser(description=description)
gattsarg(parser)
yamlarg(parser)

return parser


def tcmcdf2nc_parser():
description = "Convert raw TCM .cdf format to processed .nc files"
parser = argparse.ArgumentParser(description=description)
cdfarg(parser)

return parser
14 changes: 14 additions & 0 deletions stglib/core/runcmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,17 @@ def runwxtcsv2cdf():
metadata = get_metadata(args)

stglib.wxt.csv_to_cdf(metadata)


def runtcmcdf2nc():
args = stglib.cmd.tcmcdf2nc_parser().parse_args()

run_cdf_to_nc(stglib.tcm.cdf_to_nc, args)


def runtcmcsv2cdf():
args = stglib.cmd.tcmcsv2cdf_parser().parse_args()

metadata = get_metadata(args)

stglib.tcm.csv_to_cdf(metadata)
7 changes: 6 additions & 1 deletion stglib/hobo.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,12 @@ def ds_add_attrs(ds):

if "BPR_915" in ds:
ds["BPR_915"].attrs.update(
{"units": "mbar", "long_name": "Barometric pressure", "epic_code": 915}
{
"units": "mbar",
"long_name": "Barometric pressure",
"epic_code": 915,
"standard_name": "air_pressure",
}
)

if "T_21" in ds:
Expand Down
Loading

0 comments on commit c747a7a

Please sign in to comment.