ocstrack 0.1.0__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.
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: ocstrack
3
+ Version: 0.1.0
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
+ Dynamic: license-file
20
+
21
+ # OCSTrack
22
+ OCSTrack is an object-oriented Python package for the along-track collocation of satellite data with ocean circulation and wave model outputs.
23
+ It simplifies the process of aligning diverse datasets, making it easier to compare and analyze satellite observations against model simulations.
24
+
25
+ ## Key Features
26
+ ### Satellite Altimetry Data Support
27
+
28
+ Seamlessly integrates with NOAA [CoastalWatch](https://coastwatch.noaa.gov/cwn/products/along-track-significant-wave-height-wind-speed-and-sea-level-anomaly-multiple-altimeters.html) altimetry data, providing access to a wide range of missions:
29
+ * Jason-2
30
+ * Jason-3
31
+ * Sentinel-3A
32
+ * Sentinel-3B
33
+ * Sentinel-6A
34
+ * CryoSat-2
35
+ * SARAL
36
+ * SWOT
37
+
38
+ ### Ocean Model Data Support
39
+ Supports outputs from various ocean circulation and wave models:
40
+ * [SCHISM+WWM](https://github.com/schism-dev/schism)
41
+ * WaveWatch3 (to be implemented)
42
+ * ADCIRC+SWAN (to be implemented)
43
+
44
+
45
+ ## Installation
46
+
47
+ 1. **Create and activate a new conda environment:**
48
+ This command creates an environment named `ocstrack` and installs all dependencies from `conda-forge`.
49
+ ```bash
50
+ conda create -n ocstrack -c conda-forge python=3.10 numpy xarray scipy tqdm requests netcdf4 h5netcdf
51
+ conda activate ocstrack
52
+ ```
53
+
54
+ 2. **Install `ocstrack` from GitHub:**
55
+ Finally, install this package using `pip`.
56
+ ```bash
57
+ pip install "git+[https://github.com/noaa-ocs-modeling/OCSTrack.git](https://github.com/noaa-ocs-modeling/OCSTrack.git)"
58
+ ```
59
+
60
+ ## Usage
61
+ Here's a typical workflow demonstrating how to use OCSTrack to download satellite data, load model outputs, and perform collocation.
62
+ ```
63
+ import numpy as np
64
+ import xarray as xr
65
+ # Assuming ocstrack is installed and available in your environment
66
+ from ocstrack.Model.model import SCHISM
67
+ from ocstrack.Satellite.satellite import SatelliteData
68
+ from ocstrack.Satellite import get_sat
69
+ from ocstrack.Collocation.collocate import Collocate
70
+ from ocstrack.utils import convert_longitude
71
+
72
+
73
+ # 1. Download Satellite Data
74
+ # Specify your desired date range, list of satellites, output directory, and geographical bounding box.
75
+ get_sat.get_multi_sat(start_date="2019-07-30",
76
+ end_date="2019-08-04",
77
+ sat_list=['sentinel3a','sentinel3b','jason2','jason3','cryosat2','saral'],
78
+ output_dir=r"Your/Path/Here/",
79
+ lat_min=49.109,
80
+ lat_max=66.304309,
81
+ lon_min=156.6854,
82
+ lon_max=-156.864,
83
+ )
84
+
85
+ # 2. Define File Paths
86
+ # Set the paths for your downloaded satellite data, model run, and where you want to save the collocated output.
87
+ sat_path = "/path/to/your/multisat_cropped_2019-07-30_2019-08-04.nc"
88
+ model_path = "/path/to/your/model/run/"
89
+ output_path = "/path/to/your/collocated_output.nc"
90
+ s_time,e_time = "2019-08-01", "2019-08-03"
91
+
92
+ # 3. Load Satellite Data
93
+ # Initialize the SatelliteData object with your satellite data file.
94
+ sat_data = SatelliteData(sat_path)
95
+ # It's crucial to ensure longitude conventions match between satellite and model data.
96
+ # Use convert_longitude if needed (mode=1 for converting to 0-360 degrees).
97
+ sat_data.lon = convert_longitude(sat_data.lon, mode=1)
98
+
99
+ # 4. Load Model Data
100
+ # Instantiate the SCHISM model object, specifying the run directory and model variable details.
101
+ model_run = SCHISM(
102
+ rundir=model_path,
103
+ model_dict={'var': 'sigWaveHeight',
104
+ 'startswith': 'out2d_', # File name prefix for 2D outputs
105
+ 'var_type': '2D',
106
+ 'model': 'SCHISM'},
107
+ start_date=np.datetime64(s_time),
108
+ end_date=np.datetime64(e_time)
109
+ )
110
+
111
+ # 5. Perform Collocation
112
+ # Create a Collocate object, providing the loaded model and satellite data.
113
+ coll = Collocate(
114
+ model_run=model_run,
115
+ satellite=sat_data,
116
+ # dist_coast=dist_coast,
117
+ n_nearest=3,
118
+ # search_radius = 3000,
119
+ temporal_interp=True
120
+ )
121
+ ds_coll = coll.run(output_path=output_path) # Execute the collocation and save the results
122
+ ```
123
+
124
+ ## Contributing
125
+ We welcome contributions to OCSTrack! If you have ideas for improvements, new features, or find a bug, please don't hesitate to open an issue or submit a pull request on our GitHub repository. Your input helps make OCSTrack better for everyone.
126
+
127
+ ### Contact
128
+ <sub><sup>Contact: felicio.cassalho@noaa.gov </sup></sub>
129
+
130
+ ![NOAA logo](https://user-images.githubusercontent.com/72229285/216712553-c1e4b2fa-4b6d-4eab-be0f-f7075b6151d1.png)
131
+
132
+
133
+ #### Acknowledgements:
134
+ *OCSTrack was inspired by the MATLAB-based [WW3-tools](https://github.com/NOAA-EMC/WW3-tools) and [wave-tools](https://github.com/NOAA-EMC/WW3-tools) collocation tools developed for WaveWatch3.*
@@ -0,0 +1,114 @@
1
+ # OCSTrack
2
+ OCSTrack is an object-oriented Python package for the along-track collocation of satellite data with ocean circulation and wave model outputs.
3
+ It simplifies the process of aligning diverse datasets, making it easier to compare and analyze satellite observations against model simulations.
4
+
5
+ ## Key Features
6
+ ### Satellite Altimetry Data Support
7
+
8
+ Seamlessly integrates with NOAA [CoastalWatch](https://coastwatch.noaa.gov/cwn/products/along-track-significant-wave-height-wind-speed-and-sea-level-anomaly-multiple-altimeters.html) altimetry data, providing access to a wide range of missions:
9
+ * Jason-2
10
+ * Jason-3
11
+ * Sentinel-3A
12
+ * Sentinel-3B
13
+ * Sentinel-6A
14
+ * CryoSat-2
15
+ * SARAL
16
+ * SWOT
17
+
18
+ ### Ocean Model Data Support
19
+ Supports outputs from various ocean circulation and wave models:
20
+ * [SCHISM+WWM](https://github.com/schism-dev/schism)
21
+ * WaveWatch3 (to be implemented)
22
+ * ADCIRC+SWAN (to be implemented)
23
+
24
+
25
+ ## Installation
26
+
27
+ 1. **Create and activate a new conda environment:**
28
+ This command creates an environment named `ocstrack` and installs all dependencies from `conda-forge`.
29
+ ```bash
30
+ conda create -n ocstrack -c conda-forge python=3.10 numpy xarray scipy tqdm requests netcdf4 h5netcdf
31
+ conda activate ocstrack
32
+ ```
33
+
34
+ 2. **Install `ocstrack` from GitHub:**
35
+ Finally, install this package using `pip`.
36
+ ```bash
37
+ pip install "git+[https://github.com/noaa-ocs-modeling/OCSTrack.git](https://github.com/noaa-ocs-modeling/OCSTrack.git)"
38
+ ```
39
+
40
+ ## Usage
41
+ Here's a typical workflow demonstrating how to use OCSTrack to download satellite data, load model outputs, and perform collocation.
42
+ ```
43
+ import numpy as np
44
+ import xarray as xr
45
+ # Assuming ocstrack is installed and available in your environment
46
+ from ocstrack.Model.model import SCHISM
47
+ from ocstrack.Satellite.satellite import SatelliteData
48
+ from ocstrack.Satellite import get_sat
49
+ from ocstrack.Collocation.collocate import Collocate
50
+ from ocstrack.utils import convert_longitude
51
+
52
+
53
+ # 1. Download Satellite Data
54
+ # Specify your desired date range, list of satellites, output directory, and geographical bounding box.
55
+ get_sat.get_multi_sat(start_date="2019-07-30",
56
+ end_date="2019-08-04",
57
+ sat_list=['sentinel3a','sentinel3b','jason2','jason3','cryosat2','saral'],
58
+ output_dir=r"Your/Path/Here/",
59
+ lat_min=49.109,
60
+ lat_max=66.304309,
61
+ lon_min=156.6854,
62
+ lon_max=-156.864,
63
+ )
64
+
65
+ # 2. Define File Paths
66
+ # Set the paths for your downloaded satellite data, model run, and where you want to save the collocated output.
67
+ sat_path = "/path/to/your/multisat_cropped_2019-07-30_2019-08-04.nc"
68
+ model_path = "/path/to/your/model/run/"
69
+ output_path = "/path/to/your/collocated_output.nc"
70
+ s_time,e_time = "2019-08-01", "2019-08-03"
71
+
72
+ # 3. Load Satellite Data
73
+ # Initialize the SatelliteData object with your satellite data file.
74
+ sat_data = SatelliteData(sat_path)
75
+ # It's crucial to ensure longitude conventions match between satellite and model data.
76
+ # Use convert_longitude if needed (mode=1 for converting to 0-360 degrees).
77
+ sat_data.lon = convert_longitude(sat_data.lon, mode=1)
78
+
79
+ # 4. Load Model Data
80
+ # Instantiate the SCHISM model object, specifying the run directory and model variable details.
81
+ model_run = SCHISM(
82
+ rundir=model_path,
83
+ model_dict={'var': 'sigWaveHeight',
84
+ 'startswith': 'out2d_', # File name prefix for 2D outputs
85
+ 'var_type': '2D',
86
+ 'model': 'SCHISM'},
87
+ start_date=np.datetime64(s_time),
88
+ end_date=np.datetime64(e_time)
89
+ )
90
+
91
+ # 5. Perform Collocation
92
+ # Create a Collocate object, providing the loaded model and satellite data.
93
+ coll = Collocate(
94
+ model_run=model_run,
95
+ satellite=sat_data,
96
+ # dist_coast=dist_coast,
97
+ n_nearest=3,
98
+ # search_radius = 3000,
99
+ temporal_interp=True
100
+ )
101
+ ds_coll = coll.run(output_path=output_path) # Execute the collocation and save the results
102
+ ```
103
+
104
+ ## Contributing
105
+ We welcome contributions to OCSTrack! If you have ideas for improvements, new features, or find a bug, please don't hesitate to open an issue or submit a pull request on our GitHub repository. Your input helps make OCSTrack better for everyone.
106
+
107
+ ### Contact
108
+ <sub><sup>Contact: felicio.cassalho@noaa.gov </sup></sub>
109
+
110
+ ![NOAA logo](https://user-images.githubusercontent.com/72229285/216712553-c1e4b2fa-4b6d-4eab-be0f-f7075b6151d1.png)
111
+
112
+
113
+ #### Acknowledgements:
114
+ *OCSTrack was inspired by the MATLAB-based [WW3-tools](https://github.com/NOAA-EMC/WW3-tools) and [wave-tools](https://github.com/NOAA-EMC/WW3-tools) collocation tools developed for WaveWatch3.*