ocstrack 0.1.3.post1.dev0__tar.gz → 0.2.1.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ocstrack-0.2.1.dev0/.github/workflows/docs.yml +55 -0
- ocstrack-0.2.1.dev0/.github/workflows/lint.yml +44 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/.github/workflows/publish-to-pypi.yml +6 -3
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/.github/workflows/run-tests.yml +4 -0
- ocstrack-0.2.1.dev0/.pylintrc +26 -0
- ocstrack-0.2.1.dev0/PKG-INFO +109 -0
- ocstrack-0.2.1.dev0/README.md +85 -0
- ocstrack-0.2.1.dev0/docs/collocation.md +28 -0
- ocstrack-0.2.1.dev0/docs/index.md +85 -0
- ocstrack-0.2.1.dev0/docs/model.md +22 -0
- ocstrack-0.2.1.dev0/docs/observation.md +58 -0
- ocstrack-0.2.1.dev0/docs/utils.md +7 -0
- ocstrack-0.2.1.dev0/examples/ADCIRCSWAN_SatAlt.py +63 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/examples/Plot_Collocated.ipynb +14 -14
- ocstrack-0.2.1.dev0/examples/SCHISMWWM_SatAlt.py +64 -0
- ocstrack-0.2.1.dev0/examples/SCHISM_ArgoFloat.py +81 -0
- ocstrack-0.2.1.dev0/mkdocs.yml +47 -0
- ocstrack-0.2.1.dev0/ocstrack/Collocation/collocate.py +909 -0
- ocstrack-0.2.1.dev0/ocstrack/Collocation/output.py +227 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack/Collocation/spatial.py +19 -5
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack/Collocation/temporal.py +42 -34
- ocstrack-0.2.1.dev0/ocstrack/Model/model.py +578 -0
- ocstrack-0.2.1.dev0/ocstrack/Observation/argofloat.py +222 -0
- ocstrack-0.2.1.dev0/ocstrack/Observation/get_argo.py +498 -0
- {ocstrack-0.1.3.post1.dev0/ocstrack/Satellite → ocstrack-0.2.1.dev0/ocstrack/Observation}/get_sat.py +6 -5
- {ocstrack-0.1.3.post1.dev0/ocstrack/Satellite → ocstrack-0.2.1.dev0/ocstrack/Observation}/urls.py +4 -0
- ocstrack-0.2.1.dev0/ocstrack/_version.py +24 -0
- ocstrack-0.2.1.dev0/ocstrack.egg-info/PKG-INFO +109 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack.egg-info/SOURCES.txt +21 -5
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack.egg-info/requires.txt +1 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/pyproject.toml +1 -2
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/requirements.txt +1 -0
- ocstrack-0.2.1.dev0/tests/test_get_argo.py +91 -0
- ocstrack-0.2.1.dev0/tests/test_get_sat.py +70 -0
- ocstrack-0.2.1.dev0/tests/test_model.py +25 -0
- ocstrack-0.2.1.dev0/tests/test_spatial.py +47 -0
- ocstrack-0.1.3.post1.dev0/.pylintrc +0 -671
- ocstrack-0.1.3.post1.dev0/PKG-INFO +0 -142
- ocstrack-0.1.3.post1.dev0/README.md +0 -119
- ocstrack-0.1.3.post1.dev0/ocstrack/Collocation/collocate.py +0 -443
- ocstrack-0.1.3.post1.dev0/ocstrack/Collocation/output.py +0 -66
- ocstrack-0.1.3.post1.dev0/ocstrack/Model/model.py +0 -238
- ocstrack-0.1.3.post1.dev0/ocstrack/_version.py +0 -34
- ocstrack-0.1.3.post1.dev0/ocstrack.egg-info/PKG-INFO +0 -142
- ocstrack-0.1.3.post1.dev0/tests/test_get_sat.py +0 -3
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/.gitignore +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/LICENSE.txt +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack/Collocation/__init__.py +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack/Model/__init__.py +0 -0
- {ocstrack-0.1.3.post1.dev0/ocstrack/Satellite → ocstrack-0.2.1.dev0/ocstrack/Observation}/__init__.py +0 -0
- {ocstrack-0.1.3.post1.dev0/ocstrack/Satellite → ocstrack-0.2.1.dev0/ocstrack/Observation}/satellite.py +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack/__init__.py +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack/utils.py +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack.egg-info/dependency_links.txt +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/ocstrack.egg-info/top_level.txt +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/setup.cfg +0 -0
- {ocstrack-0.1.3.post1.dev0 → ocstrack-0.2.1.dev0}/setup.py +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# GitHub Actions workflow for building and deploying the MkDocs site
|
|
2
|
+
|
|
3
|
+
name: Deploy Documentation
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
build:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
env:
|
|
18
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
19
|
+
steps:
|
|
20
|
+
- name: Check out code
|
|
21
|
+
uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: '3.11'
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: |
|
|
30
|
+
python -m pip install --upgrade pip
|
|
31
|
+
pip install -r requirements.txt
|
|
32
|
+
pip install mkdocs-material "mkdocstrings[python]"
|
|
33
|
+
pip install .
|
|
34
|
+
|
|
35
|
+
- name: Build MkDocs site
|
|
36
|
+
run: mkdocs build
|
|
37
|
+
|
|
38
|
+
- name: Upload artifact
|
|
39
|
+
uses: actions/upload-pages-artifact@v3
|
|
40
|
+
with:
|
|
41
|
+
path: ./site
|
|
42
|
+
|
|
43
|
+
deploy:
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
permissions:
|
|
47
|
+
pages: write
|
|
48
|
+
id-token: write
|
|
49
|
+
environment:
|
|
50
|
+
name: github-pages
|
|
51
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
52
|
+
steps:
|
|
53
|
+
- name: Deploy to GitHub Pages
|
|
54
|
+
id: deployment
|
|
55
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# GitHub Actions workflow for Continuous Integration (CI)
|
|
2
|
+
|
|
3
|
+
name: CI
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
build:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
env:
|
|
17
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
18
|
+
steps:
|
|
19
|
+
- name: Check out code
|
|
20
|
+
uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Set up Python
|
|
23
|
+
uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: '3.9'
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: |
|
|
29
|
+
python -m pip install --upgrade pip
|
|
30
|
+
pip install -r requirements.txt
|
|
31
|
+
pip install pylint pytest pytest-cov
|
|
32
|
+
|
|
33
|
+
- name: Run Pylint
|
|
34
|
+
run: |
|
|
35
|
+
python -m pylint ocstrack
|
|
36
|
+
|
|
37
|
+
- name: Run Pytest and Generate Coverage Report
|
|
38
|
+
run: |
|
|
39
|
+
python -m pytest --cov=ocstrack --cov-report=xml
|
|
40
|
+
|
|
41
|
+
- name: Upload Coverage to Codecov
|
|
42
|
+
uses: codecov/codecov-action@v3
|
|
43
|
+
with:
|
|
44
|
+
token: ${{ secrets.CODECOV_TOKEN }} # Optional for public repos
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
# .github/workflows/publish-to-pypi.yml
|
|
2
2
|
#
|
|
3
3
|
# This workflow builds and publishes the package to PyPI
|
|
4
|
-
# every time you
|
|
4
|
+
# every time you push a new tag that starts with 'v'.
|
|
5
5
|
#
|
|
6
6
|
name: Publish Python - PyPI
|
|
7
7
|
|
|
8
8
|
on:
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
push:
|
|
10
|
+
tags:
|
|
11
|
+
- 'v*'
|
|
11
12
|
|
|
12
13
|
jobs:
|
|
13
14
|
deploy:
|
|
14
15
|
runs-on: ubuntu-latest
|
|
16
|
+
env:
|
|
17
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
15
18
|
|
|
16
19
|
steps:
|
|
17
20
|
- uses: actions/checkout@v4
|
|
@@ -9,6 +9,8 @@ jobs:
|
|
|
9
9
|
# --- JOB 1: RUN PYLINT --- #
|
|
10
10
|
lint:
|
|
11
11
|
runs-on: ubuntu-latest # No need to run on all OSs
|
|
12
|
+
env:
|
|
13
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
12
14
|
steps:
|
|
13
15
|
- name: Check out code
|
|
14
16
|
uses: actions/checkout@v4
|
|
@@ -33,6 +35,8 @@ jobs:
|
|
|
33
35
|
# --- JOB 2: RUN TESTS --- #
|
|
34
36
|
test:
|
|
35
37
|
runs-on: ${{ matrix.os }}
|
|
38
|
+
env:
|
|
39
|
+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
36
40
|
strategy:
|
|
37
41
|
matrix:
|
|
38
42
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# .pylintrc - Configuration for Pylint
|
|
2
|
+
|
|
3
|
+
[MAIN]
|
|
4
|
+
# A comma-separated list of plugin modules to load.
|
|
5
|
+
load-plugins=
|
|
6
|
+
|
|
7
|
+
[MESSAGES CONTROL]
|
|
8
|
+
# Disable specific messages by their symbolic name.
|
|
9
|
+
# docstring-first-line: Good practice, but can be noisy initially.
|
|
10
|
+
# missing-module-docstring: Disabling for now to focus on code logic.
|
|
11
|
+
# missing-class-docstring: Your classes have good docstrings.
|
|
12
|
+
# missing-function-docstring: Your functions have good docstrings.
|
|
13
|
+
# trailing-whitespace: This is better handled by a code formatter like black or ruff.
|
|
14
|
+
disable=
|
|
15
|
+
missing-module-docstring,
|
|
16
|
+
trailing-whitespace
|
|
17
|
+
|
|
18
|
+
[REPORTS]
|
|
19
|
+
# Set the failure threshold for the score.
|
|
20
|
+
# If the score is below this value, Pylint will exit with an error code.
|
|
21
|
+
# This is what CI systems use to fail a build.
|
|
22
|
+
fail-under=7.5
|
|
23
|
+
|
|
24
|
+
[FORMAT]
|
|
25
|
+
# Set the expected maximum line length.
|
|
26
|
+
max-line-length=100
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ocstrack
|
|
3
|
+
Version: 0.2.1.dev0
|
|
4
|
+
Summary: Satellite data download, crop, and collocation with model outputs
|
|
5
|
+
Author-email: Felicio Cassalho <felicio.cassalho@noaa.gov>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/noaa-ocs-modeling/OCSTrack
|
|
8
|
+
Project-URL: Repository, https://github.com/noaa-ocs-modeling/OCSTrack
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
License-File: LICENSE.txt
|
|
12
|
+
Requires-Dist: numpy
|
|
13
|
+
Requires-Dist: xarray
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: tqdm
|
|
16
|
+
Requires-Dist: requests
|
|
17
|
+
Requires-Dist: netcdf4
|
|
18
|
+
Requires-Dist: h5netcdf
|
|
19
|
+
Requires-Dist: dask
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=6.0; extra == "dev"
|
|
22
|
+
Requires-Dist: pylint; extra == "dev"
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# OCSTrack: Ocean-Model-Data Collocation Tools
|
|
26
|
+
|
|
27
|
+
[](https://github.com/noaa-ocs-modeling/OCSTrack/actions/workflows/lint.yml)
|
|
28
|
+
[](https://badge.fury.io/py/ocstrack)
|
|
29
|
+
[](https://codecov.io/gh/noaa-ocs-modeling/OCSTrack)
|
|
30
|
+
[](https://github.com/noaa-ocs-modeling/OCSTrack/actions/workflows/lint.yml)
|
|
31
|
+
[](http://creativecommons.org/publicdomain/zero/1.0/)
|
|
32
|
+
|
|
33
|
+
**OCSTrack** is an object-oriented Python package for the along-track collocation of satellite (2D) and Argo Float (3D) data with ocean circulation and wave model outputs. It simplifies the process of aligning diverse datasets, making it easier to compare and validate model simulations against observational data.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Key Features
|
|
38
|
+
|
|
39
|
+
- **Automated Data Fetching**: Downloads satellite altimetry and Argo float data from public repositories.
|
|
40
|
+
- **Model Support**: Natively handles outputs from SCHISM, ADCIRC, and SWAN models.
|
|
41
|
+
- **Flexible Collocation**: Performs temporal and spatial collocation for both 2D surface tracks and 3D profiles.
|
|
42
|
+
- **Efficient & Scalable**: Uses `xarray` and `dask` for efficient, out-of-core computations on large datasets.
|
|
43
|
+
- **Customizable**: Object-oriented design makes it easy to extend support for new models or observational data types.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
You can install OCSTrack directly from PyPI:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install ocstrack
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
To install the latest development version directly from this repository:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install git+https://github.com/noaa-ocs-modeling/OCSTrack.git
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
Here is a minimal example of how to collocate satellite altimetry data with a SCHISM model run.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from ocstrack import Collocate
|
|
65
|
+
from ocstrack.Model import SCHISM
|
|
66
|
+
from ocstrack.Observation import Satellite
|
|
67
|
+
|
|
68
|
+
# 1. Define time range and region of interest
|
|
69
|
+
start_date = '2021-05-01'
|
|
70
|
+
end_date = '2021-05-05'
|
|
71
|
+
bbox = [-76, 34, -72, 38] # [lon_min, lat_min, lon_max, lat_max]
|
|
72
|
+
|
|
73
|
+
# 2. Initialize the Model object
|
|
74
|
+
# This assumes a SCHISM run directory with standard outputs
|
|
75
|
+
schism_run_dir = '/path/to/your/schism/run/'
|
|
76
|
+
model = SCHISM(schism_run_dir, start_date=start_date, end_date=end_date)
|
|
77
|
+
|
|
78
|
+
# 3. Initialize the Observation object
|
|
79
|
+
sat_name = 'sentinel-3a' # Example satellite
|
|
80
|
+
observation = Satellite(sat_name, start_date=start_date, end_date=end_date, bbox=bbox)
|
|
81
|
+
|
|
82
|
+
# 4. Create a Collocation object and run the analysis
|
|
83
|
+
collocator = Collocate(model, observation)
|
|
84
|
+
collocated_dataset = collocator.run(output_path='collocated_data.nc')
|
|
85
|
+
|
|
86
|
+
print("Collocation complete!")
|
|
87
|
+
print(collocated_dataset)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
For more detailed examples and the full API reference, please see our documentation website:
|
|
93
|
+
|
|
94
|
+
[**https://noaa-ocs-modeling.github.io/OCSTrack/**](https://noaa-ocs-modeling.github.io/OCSTrack/)
|
|
95
|
+
|
|
96
|
+
## Contributing
|
|
97
|
+
|
|
98
|
+
We welcome contributions! If you have ideas for new features, find a bug, or would like to improve the documentation, please open an issue or submit a pull request.
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
This project is licensed under the terms of the CC0 1.0 Universal license. See the `LICENSE.txt` file for details.
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
#### Disclaimer
|
|
108
|
+
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.
|
|
109
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# OCSTrack: Ocean-Model-Data Collocation Tools
|
|
2
|
+
|
|
3
|
+
[](https://github.com/noaa-ocs-modeling/OCSTrack/actions/workflows/lint.yml)
|
|
4
|
+
[](https://badge.fury.io/py/ocstrack)
|
|
5
|
+
[](https://codecov.io/gh/noaa-ocs-modeling/OCSTrack)
|
|
6
|
+
[](https://github.com/noaa-ocs-modeling/OCSTrack/actions/workflows/lint.yml)
|
|
7
|
+
[](http://creativecommons.org/publicdomain/zero/1.0/)
|
|
8
|
+
|
|
9
|
+
**OCSTrack** is an object-oriented Python package for the along-track collocation of satellite (2D) and Argo Float (3D) data with ocean circulation and wave model outputs. It simplifies the process of aligning diverse datasets, making it easier to compare and validate model simulations against observational data.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- **Automated Data Fetching**: Downloads satellite altimetry and Argo float data from public repositories.
|
|
16
|
+
- **Model Support**: Natively handles outputs from SCHISM, ADCIRC, and SWAN models.
|
|
17
|
+
- **Flexible Collocation**: Performs temporal and spatial collocation for both 2D surface tracks and 3D profiles.
|
|
18
|
+
- **Efficient & Scalable**: Uses `xarray` and `dask` for efficient, out-of-core computations on large datasets.
|
|
19
|
+
- **Customizable**: Object-oriented design makes it easy to extend support for new models or observational data types.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
You can install OCSTrack directly from PyPI:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install ocstrack
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To install the latest development version directly from this repository:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install git+https://github.com/noaa-ocs-modeling/OCSTrack.git
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
Here is a minimal example of how to collocate satellite altimetry data with a SCHISM model run.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from ocstrack import Collocate
|
|
41
|
+
from ocstrack.Model import SCHISM
|
|
42
|
+
from ocstrack.Observation import Satellite
|
|
43
|
+
|
|
44
|
+
# 1. Define time range and region of interest
|
|
45
|
+
start_date = '2021-05-01'
|
|
46
|
+
end_date = '2021-05-05'
|
|
47
|
+
bbox = [-76, 34, -72, 38] # [lon_min, lat_min, lon_max, lat_max]
|
|
48
|
+
|
|
49
|
+
# 2. Initialize the Model object
|
|
50
|
+
# This assumes a SCHISM run directory with standard outputs
|
|
51
|
+
schism_run_dir = '/path/to/your/schism/run/'
|
|
52
|
+
model = SCHISM(schism_run_dir, start_date=start_date, end_date=end_date)
|
|
53
|
+
|
|
54
|
+
# 3. Initialize the Observation object
|
|
55
|
+
sat_name = 'sentinel-3a' # Example satellite
|
|
56
|
+
observation = Satellite(sat_name, start_date=start_date, end_date=end_date, bbox=bbox)
|
|
57
|
+
|
|
58
|
+
# 4. Create a Collocation object and run the analysis
|
|
59
|
+
collocator = Collocate(model, observation)
|
|
60
|
+
collocated_dataset = collocator.run(output_path='collocated_data.nc')
|
|
61
|
+
|
|
62
|
+
print("Collocation complete!")
|
|
63
|
+
print(collocated_dataset)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
For more detailed examples and the full API reference, please see our documentation website:
|
|
69
|
+
|
|
70
|
+
[**https://noaa-ocs-modeling.github.io/OCSTrack/**](https://noaa-ocs-modeling.github.io/OCSTrack/)
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
|
|
74
|
+
We welcome contributions! If you have ideas for new features, find a bug, or would like to improve the documentation, please open an issue or submit a pull request.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
This project is licensed under the terms of the CC0 1.0 Universal license. See the `LICENSE.txt` file for details.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
#### Disclaimer
|
|
84
|
+
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.
|
|
85
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Collocation
|
|
2
|
+
|
|
3
|
+
This section provides the core tools for collocating model and observational data.
|
|
4
|
+
|
|
5
|
+
## Core Collocation
|
|
6
|
+
|
|
7
|
+
The main `Collocate` class is the primary entry point for running the collocation analysis.
|
|
8
|
+
|
|
9
|
+
!!! note
|
|
10
|
+
The `Collocate` class is designed to be used with a `Model` object and an `Observation` object as inputs.
|
|
11
|
+
|
|
12
|
+
::: ocstrack.Collocation.collocate
|
|
13
|
+
|
|
14
|
+
## Output & Spatial/Temporal Helpers
|
|
15
|
+
|
|
16
|
+
These modules provide helper functions for handling the output of the collocation, as well as for spatial and temporal operations.
|
|
17
|
+
|
|
18
|
+
### Output
|
|
19
|
+
|
|
20
|
+
::: ocstrack.Collocation.output
|
|
21
|
+
|
|
22
|
+
### Spatial
|
|
23
|
+
|
|
24
|
+
::: ocstrack.Collocation.spatial
|
|
25
|
+
|
|
26
|
+
### Temporal
|
|
27
|
+
|
|
28
|
+
::: ocstrack.Collocation.temporal
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# OCSTrack: Ocean-Model-Data Collocation Tools
|
|
2
|
+
|
|
3
|
+
[](https://github.com/noaa-ocs-modeling/OCSTrack/actions/workflows/lint.yml)
|
|
4
|
+
[](https://badge.fury.io/py/ocstrack)
|
|
5
|
+
[](https://codecov.io/gh/noaa-ocs-modeling/OCSTrack)
|
|
6
|
+
[](https://github.com/noaa-ocs-modeling/OCSTrack/actions/workflows/lint.yml)
|
|
7
|
+
[](http://creativecommons.org/publicdomain/zero/1.0/)
|
|
8
|
+
|
|
9
|
+
**OCSTrack** is an object-oriented Python package for the along-track collocation of satellite (2D) and Argo Float (3D) data with ocean circulation and wave model outputs. It simplifies the process of aligning diverse datasets, making it easier to compare and validate model simulations against observational data.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Key Features
|
|
14
|
+
|
|
15
|
+
- **Automated Data Fetching**: Downloads satellite altimetry and Argo float data from public repositories.
|
|
16
|
+
- **Model Support**: Natively handles outputs from SCHISM, ADCIRC, and SWAN models.
|
|
17
|
+
- **Flexible Collocation**: Performs temporal and spatial collocation for both 2D surface tracks and 3D profiles.
|
|
18
|
+
- **Efficient & Scalable**: Uses `xarray` and `dask` for efficient, out-of-core computations on large datasets.
|
|
19
|
+
- **Customizable**: Object-oriented design makes it easy to extend support for new models or observational data types.
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
You can install OCSTrack directly from PyPI:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install ocstrack
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
To install the latest development version directly from this repository:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install git+https://github.com/noaa-ocs-modeling/OCSTrack.git
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
Here is a minimal example of how to collocate satellite altimetry data with a SCHISM model run.
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from ocstrack import Collocate
|
|
41
|
+
from ocstrack.Model import SCHISM
|
|
42
|
+
from ocstrack.Observation import Satellite
|
|
43
|
+
|
|
44
|
+
# 1. Define time range and region of interest
|
|
45
|
+
start_date = '2021-05-01'
|
|
46
|
+
end_date = '2021-05-05'
|
|
47
|
+
bbox = [-76, 34, -72, 38] # [lon_min, lat_min, lon_max, lat_max]
|
|
48
|
+
|
|
49
|
+
# 2. Initialize the Model object
|
|
50
|
+
# This assumes a SCHISM run directory with standard outputs
|
|
51
|
+
schism_run_dir = '/path/to/your/schism/run/'
|
|
52
|
+
model = SCHISM(schism_run_dir, start_date=start_date, end_date=end_date)
|
|
53
|
+
|
|
54
|
+
# 3. Initialize the Observation object
|
|
55
|
+
sat_name = 'sentinel-3a' # Example satellite
|
|
56
|
+
observation = Satellite(sat_name, start_date=start_date, end_date=end_date, bbox=bbox)
|
|
57
|
+
|
|
58
|
+
# 4. Create a Collocation object and run the analysis
|
|
59
|
+
collocator = Collocate(model, observation)
|
|
60
|
+
collocated_dataset = collocator.run(output_path='collocated_data.nc')
|
|
61
|
+
|
|
62
|
+
print("Collocation complete!")
|
|
63
|
+
print(collocated_dataset)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
For more detailed examples and the full API reference, please see our documentation website:
|
|
69
|
+
|
|
70
|
+
[**https://noaa-ocs-modeling.github.io/OCSTrack/**](https://noaa-ocs-modeling.github.io/OCSTrack/)
|
|
71
|
+
|
|
72
|
+
## Contributing
|
|
73
|
+
|
|
74
|
+
We welcome contributions! If you have ideas for new features, find a bug, or would like to improve the documentation, please open an issue or submit a pull request.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
This project is licensed under the terms of the CC0 1.0 Universal license. See the `LICENSE.txt` file for details.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
#### Disclaimer
|
|
84
|
+
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.
|
|
85
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Model Interfaces
|
|
2
|
+
|
|
3
|
+
This section provides interfaces for different ocean models.
|
|
4
|
+
|
|
5
|
+
## SCHISM Model
|
|
6
|
+
|
|
7
|
+
The `SCHISM` class provides an interface for handling SCHISM model outputs.
|
|
8
|
+
|
|
9
|
+
::: ocstrack.Model.model.SCHISM
|
|
10
|
+
|
|
11
|
+
## ADCSWAN Model
|
|
12
|
+
|
|
13
|
+
The `ADCSWAN` class provides an interface for handling ADCIRC+SWAN model outputs.
|
|
14
|
+
|
|
15
|
+
::: ocstrack.Model.model.ADCSWAN
|
|
16
|
+
|
|
17
|
+
## Utility Functions
|
|
18
|
+
|
|
19
|
+
These are helper functions used by the model interfaces.
|
|
20
|
+
|
|
21
|
+
::: ocstrack.Model.model.natural_sort_key
|
|
22
|
+
::: ocstrack.Model.model._parse_gr3_mesh
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Observation Data
|
|
2
|
+
|
|
3
|
+
This section covers tools for downloading, processing, and handling observational data from satellite altimetry and Argo floats.
|
|
4
|
+
|
|
5
|
+
## Data Handlers
|
|
6
|
+
|
|
7
|
+
These classes are used to interact with processed observational data within the collocation workflow.
|
|
8
|
+
|
|
9
|
+
### Argo Floats
|
|
10
|
+
|
|
11
|
+
::: ocstrack.Observation.argofloat.ArgoData
|
|
12
|
+
|
|
13
|
+
### Satellite Altimetry
|
|
14
|
+
|
|
15
|
+
::: ocstrack.Observation.satellite.SatelliteData
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Data Acquisition
|
|
20
|
+
|
|
21
|
+
These functions are high-level entry points for downloading and pre-processing raw data from public repositories.
|
|
22
|
+
|
|
23
|
+
### Argo Data Acquisition
|
|
24
|
+
|
|
25
|
+
Use these functions to download and prepare Argo float data.
|
|
26
|
+
|
|
27
|
+
!!! tip
|
|
28
|
+
The main function to use here is `get_argo`. It orchestrates the entire download and processing pipeline.
|
|
29
|
+
|
|
30
|
+
::: ocstrack.Observation.get_argo.get_argo
|
|
31
|
+
::: ocstrack.Observation.get_argo.download_argo_data
|
|
32
|
+
::: ocstrack.Observation.get_argo.crop_argo_data
|
|
33
|
+
::: ocstrack.Observation.get_argo.clean_argo_data
|
|
34
|
+
::: ocstrack.Observation.get_argo.generate_monthly_dates
|
|
35
|
+
::: ocstrack.Observation.get_argo.crop_by_box_argo
|
|
36
|
+
|
|
37
|
+
### Satellite Data Acquisition
|
|
38
|
+
|
|
39
|
+
Use these functions to download and prepare satellite altimetry data.
|
|
40
|
+
|
|
41
|
+
!!! tip
|
|
42
|
+
The main functions to use here are `get_per_sat` for a single satellite and `get_multi_sat` for multiple satellites.
|
|
43
|
+
|
|
44
|
+
::: ocstrack.Observation.get_sat.get_per_sat
|
|
45
|
+
::: ocstrack.Observation.get_sat.get_multi_sat
|
|
46
|
+
::: ocstrack.Observation.get_sat.download_sat_data
|
|
47
|
+
::: ocstrack.Observation.get_sat.crop_sat_data
|
|
48
|
+
::: ocstrack.Observation.get_sat.concat_sat_data
|
|
49
|
+
::: ocstrack.Observation.get_sat.generate_daily_dates
|
|
50
|
+
::: ocstrack.Observation.get_sat.crop_by_box
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Data URLs
|
|
55
|
+
|
|
56
|
+
This module contains the base URLs for the data sources.
|
|
57
|
+
|
|
58
|
+
::: ocstrack.Observation.urls
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
from ocstrack.Model.model import ADCSWAN
|
|
3
|
+
from ocstrack.Observation.satellite import SatelliteData
|
|
4
|
+
from ocstrack.Observation import get_sat
|
|
5
|
+
from ocstrack.Collocation.collocate import Collocate
|
|
6
|
+
# from ocstrack.utils import convert_longitude
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# 1. Download Satellite Data
|
|
10
|
+
# Specify your desired date range, list of satellites, output directory, and geographical bounding box.
|
|
11
|
+
print("get_sat begin")
|
|
12
|
+
get_sat.get_multi_sat(start_date="2020-12-13",
|
|
13
|
+
end_date="2020-12-31",
|
|
14
|
+
sat_list=['sentinel3a','sentinel3b','jason2','jason3','cryosat2','saral','swot','sentinel6a'],
|
|
15
|
+
output_dir=r"Your/Path/where to save the sat altimetry/Here/",
|
|
16
|
+
lat_min=7,
|
|
17
|
+
lat_max=46,
|
|
18
|
+
lon_min=-98,
|
|
19
|
+
lon_max=-60,
|
|
20
|
+
)
|
|
21
|
+
print("get_sat end")
|
|
22
|
+
|
|
23
|
+
print("load sat begin")
|
|
24
|
+
# 2. Define File Paths
|
|
25
|
+
# Set the paths for your downloaded satellite data, model run, and where you want to save the collocated output.
|
|
26
|
+
sat_path = r"Your/Path/to/Downloaded Satellite Data/Here/",
|
|
27
|
+
model_path = r"Your/Path/to/ADCIRC+SWAN run dir/Here/",
|
|
28
|
+
output_path = r"Your/Path/Here/adcswn_collocated.nc",
|
|
29
|
+
s_time,e_time = "2019-07-30", "2019-08-03"
|
|
30
|
+
|
|
31
|
+
# 3. Load Satellite Data
|
|
32
|
+
# Initialize the SatelliteData object with your satellite data file.
|
|
33
|
+
sat_data = SatelliteData(sat_path)
|
|
34
|
+
# It's crucial to ensure longitude conventions match between satellite and model data.
|
|
35
|
+
# Use convert_longitude if needed (mode=1 for converting to 0-360 degrees).
|
|
36
|
+
# sat_data.lon = convert_longitude(sat_data.lon, mode=1)
|
|
37
|
+
|
|
38
|
+
print("load model begin")
|
|
39
|
+
# 4. Load Model Data
|
|
40
|
+
# Instantiate the SCHISM model object, specifying the run directory and model variable details.
|
|
41
|
+
model_run = ADCSWAN(
|
|
42
|
+
rundir=model_path,
|
|
43
|
+
model_dict={'var': 'swan_HS',
|
|
44
|
+
'startswith': 'swan_HS.63.nc',
|
|
45
|
+
# 'var_type': '2D',
|
|
46
|
+
'model': 'ADCSWAN'},
|
|
47
|
+
start_date=np.datetime64(s_time),
|
|
48
|
+
end_date=np.datetime64(e_time)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
print("Collocation begin")
|
|
52
|
+
# 5. Perform Collocation
|
|
53
|
+
# Create a Collocate object, providing the loaded model and satellite data.A
|
|
54
|
+
# dist_coast = xr.open_dataset(r'Your/Path/to/OPTIONAL/distFromCoast.nc')
|
|
55
|
+
coll = Collocate(
|
|
56
|
+
model_run=model_run,
|
|
57
|
+
observation=sat_data,
|
|
58
|
+
# dist_coast=dist_coast,
|
|
59
|
+
n_nearest=3,
|
|
60
|
+
# search_radius = 3000,
|
|
61
|
+
temporal_interp=True
|
|
62
|
+
)
|
|
63
|
+
ds_coll = coll.run(output_path=output_path) # Execute the collocation and save the results
|