Skip to main content

This python package provides utilities for encoding hydrographic datasets in the International Hydrographic Organization (IHO) S-100 format

Project description

s100py

Python Utilities for Working with IHO S-100 Data Formats

Overview

This python package provides utilities for encoding hydrographic datasets in the International Hydrographic Organization (IHO) S-100 format.

Background

The IHO S-100 standard is a data framework for digital products and services for hydrographic, maritime, and GIS communities, comprised of multiple data encoding formats designed for interoperability with Electronic Navigational Charts (ENCs).

The initial focus of this package is on two of the S-100 encoding formats:

  • S-104 Water Level Information for Surface Navigation
  • S-111 Surface Currents

However, support for additional formats will likely be added in the future.

For further information about S-100 formats, see the IHO website.

Features

  • Create and modify S-111 compliant HDF5 files in all four data coding formats:

    1.  Time-series at fixed station
    2.  Regularly-gridded arrays
    3.  Ungeorectified gridded arrays (i.e. irregular grid)
    4.  Time series for moving platform
    
  • Chop output into multiple subgrids (i.e. tiles), each written to a distinct S-111 file, to reduce file sizes

  • Create and modify HDF5 S-100/S-111 metadata

Requirements

This codebase is written for Python 3 and relies on the following python packages:

Installation

This package relies on thyme, which may require downloading/compiling additional libraries before installation. See the thyme documentation for install instructions.

After thyme has been installed, s100py can be installed with pip:

pip install s100py

Example Usage

Create an S-111 File (Type 1):

from s100py import s111

data_coding_format = 1

# meters below sea surface (0 = at/near surface)
current_depth = 0

file_metadata = s111.S111Metadata(
        "Gulf of Mexico",  # region
        "harmonic_current_predictions",  # product description
        3,  # current type code for astronomical prediction
        "US",  # producer code
        "station1234",  # station id
        None)  # model identifier

input_data = []
input_data.append(
    s111.S111TimeSeries(
            longitude,  # 1D `numpy.ndarray` containing longitude values
            latitude,  # 1D `numpy.ndarray` containing latitude values
            speed,  # 1D `numpy.ndarray` containing speed values in knots
            direction,  # 1D `numpy.ndarray` containing Direction values in arc-degrees
            datetime_values))  # List containing a `datetime.datetime` for each observation in the series

s111.time_series_to_s111(
        input_data,
        '/path/to/s111_directory',
        file_metadata,
        data_coding_format,
        current_depth)

Create an S-111 File (Type 2)

NOS Chesapeake Bay Operational Forecast System file valid at 7/9/2019 0000 UTC:

import datetime
from s100py import s111
from thyme.model import roms

data_coding_format = 2
target_cellsize = 500 # meters

# meters below sea surface (0 = at/near surface), default = 4.5 m
target_depth = 0

file_metadata = s111.S111Metadata(
        "Chesapeake Bay",  # region
        "ROMS_Hydrodynamic_Model_Forecasts",  # product type description
        6,  # current data type for hydrodynamic forecast
        "US",  # producer code
        None,  # station id
        "CBOFS")  # model identifier

native_model_file = roms.ROMSFile('/path/to/nos.cbofs.fields.f001.20190709.t00z.nc')
model_index_file = roms.ROMSIndexFile('/path/to/create/index_file.nc')

try:
    native_model_file.open()
    model_index_file.open()
    model_index_file.init_nc(native_model_file, target_cellsize, 'my_roms_model', '/path/to/shoreline_shapefile.shp')

finally:
    model_index_file.close()
    native_model_file.close()

s111.model_to_s111(
        model_index_file,
        [native_model_file],
        '/path/to/s111_directory',
        datetime.datetime(2019, 7, 9, 0, 0),
        file_metadata,
        data_coding_format,
        target_depth)

Create an S-111 File (Type 3)

NOS Chesapeake Bay Operational Forecast System file valid at 7/9/2019 0000 UTC:

import datetime
from s100py import s111
from thyme.model import roms

data_coding_format = 3

# meters below sea surface (0 = at/near surface), default = 4.5 m
target_depth = 0

file_metadata = s111.S111Metadata(
        "Chesapeake Bay",  # region
        "ROMS_Hydrodynamic_Model_Forecasts",  # product type description
        6,  # current data type for hydrodynamic forecast
        "US",  # producer code
        None,  # station id
        "CBOFS")  # model identifier

native_model_file = roms.ROMSFile('/path/to/nos.cbofs.fields.f001.20190709.t00z.nc')

s111.model_to_s111(
        None,
        [native_model_file],
        '/path/to/s111_directory',
        datetime.datetime(2019, 7, 9, 0, 0),
        file_metadata,
        data_coding_format,
        target_depth)

Create an S-111 file (Type 4):

from s100py import s111

data_coding_format = 4

# meters below sea surface (0 = at/near surface)
current_depth = 15

file_metadata = s111.S111Metadata(
        "Western_N_Pacific_Ocean_Philippine_Sea",  # region
        "argos_lagrangian_drifter_12hr_interpolated",  # product type description
        4,  # current type code for analysis or hybrid method
        "US",  # producer code
        None,  # station id
        None)  # model identifier

input_data = []
input_data.append(
    s111.S111TimeSeries(
            longitude,  # 1D `numpy.ndarray` containing longitude values
            latitude,  # 1D `numpy.ndarray` containing latitude values
            speed,  # 1D `numpy.ndarray` containing speed values in knots
            direction,  # 1D `numpy.ndarray` containing Direction values in arc-degrees
            datetime_values))  # List containing a `datetime.datetime` for each observation in the series

s111.time_series_to_s111(
        input_data,
        '/path/to/s111_directory',
        file_metadata,
        data_coding_format,
        current_depth)

Authors

License

This work, as a whole, is licensed under the BSD 2-Clause License (see LICENSE), however it contains major contributions from the U.S. National Oceanic and Atmospheric Administration (NOAA), 2017 - 2019, which are individually dedicated to the public domain.

Disclaimer

This repository is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an 'as is' basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government.

Acknowledgments

This software has been developed by the National Oceanic and Atmospheric Administration (NOAA)/National Ocean Service (NOS)/Office of Coast Survey (OCS)/Coast Survey Development Lab (CSDL) for use by the scientific and oceanographic communities.

CSDL wishes to thank the following entities for their assistance:

  • NOAA/NOS/Center for Operational Oceanographic Products and Services (CO-OPS)
  • Canadian Hydrographic Service (CHS)
  • Teledyne CARIS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

s100py-0.3.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

s100py-0.3.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file s100py-0.3.0.tar.gz.

File metadata

  • Download URL: s100py-0.3.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for s100py-0.3.0.tar.gz
Algorithm Hash digest
SHA256 352e9dc6c02de5c30c511df397459f0ec88443bad5bef6ecb75005583fe5fa4b
MD5 61e1fb29496033e6009674f7e68c845a
BLAKE2b-256 2a04518840ceea3a61e4e237e142fc7cedbfc2216a6e08fec0151b785540bd05

See more details on using hashes here.

File details

Details for the file s100py-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: s100py-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.4

File hashes

Hashes for s100py-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b7cde4780e81ed5699fabaf9b0e71f42a361960932c420c8332c18c69f76489
MD5 ad0113d838760dd40fce4fe960e19d63
BLAKE2b-256 acb6d0697907383592cceb3f8d86d8ad431acb0fef20b90aac87753a55822ba3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page