|
1 | 1 | # seagliderOG1 |
2 | 2 |
|
3 | | -This repository is intended to convert Seaglider basestation files (`pSSSDDDD*.nc`) into [OG1 format](https://oceangliderscommunity.github.io/OG-format-user-manual/OG_Format.html). |
4 | | - |
5 | | -Code is based on code from [votoutils](https://github.com/voto-ocean-knowledge/votoutils/blob/main/votoutils/glider/convert_to_og1.py). |
6 | | - |
7 | | -### Organisation |
8 | | - |
9 | | -Scripts within the `seagliderOG1` package are divided by functionality: |
10 | | - |
11 | | -- **readers.py** reads basestation files (`*.nc`) from a server or local directory |
12 | | -- **writers.py** writes OG1 `*.nc` files, default directory `data/` |
13 | | -- **plotters.py** contains some basic plotting and viewing functions |
14 | | -- **convertOG1.py** converts the basestation files to OG1 format |
15 | | -- **vocabularies.py** contains some of the vocabulary translation (might be better as a YAML file) |
16 | | -- *seaglider_registr.txt* has checksums for data files |
17 | | -- **tools.py** functions the user may want to use |
18 | | -- **utilities.py** functions the user probably will never need to call (only used in other functions) |
19 | | - |
20 | | -### Directory |
21 | | -File directory structure is as follows. |
22 | | - |
23 | | -seagliderOG1/ |
24 | | -- .github/ |
25 | | -- config/ |
26 | | - - OG1_author.yaml |
27 | | - - OG1_global_attrs.yaml |
28 | | - - OG1_global_attrs.yaml |
29 | | - - OG1_sensor_attrs.yaml |
30 | | - - OG1_var_names.yaml |
31 | | - - OG1_vocab_attrs.yaml |
32 | | - - mission_yaml.yaml |
33 | | -- data/ |
34 | | - - test.nc |
35 | | -- notebooks/ |
36 | | - - dev_notebooks/ |
37 | | - - dev-troubleshoot.ipynb |
38 | | - - download_and_register.ipynb |
39 | | - - demo.ipynb |
40 | | -- seagliderOG1/ |
41 | | - - convertOG1.py |
42 | | - - plotters.py |
43 | | - - readers.py |
44 | | - - seaglider_registry.txt |
45 | | - - tools.py |
46 | | - - utilities.py |
47 | | - - vocabularies.py |
48 | | - - writers.py |
49 | | -- tests/ |
50 | | - - test_readers.py |
51 | | -- .gitignore |
52 | | -- LICENSE |
53 | | -- README.md |
54 | | -- requirements-dev.txt |
55 | | -- requirements.txt |
56 | | - |
57 | | - |
58 | | -### Status |
59 | | - |
60 | | -Still early days, but collaborations welcome! |
| 3 | +A[](https://github.com/ocean-uhh/seagliderOG1/actions/workflows/tests.yml) |
| 4 | +[](https://github.com/ocean-uhh/seagliderOG1/actions/workflows/docs_deploy.yml) |
| 5 | + |
| 6 | +This repository converts Seaglider basestation files (`pSSSDDDD*.nc`) into [OG1 format](https://oceangliderscommunity.github.io/OG-format-user-manual/OG_Format.html) for standardized oceanographic glider data. |
| 7 | + |
| 8 | +Code is based on [votoutils](https://github.com/voto-ocean-knowledge/votoutils/blob/main/votoutils/glider/convert_to_og1.py). |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +### Recommended: Using pip |
| 13 | + |
| 14 | +For most users, pip installation is the simplest approach: |
| 15 | + |
| 16 | +```bash |
| 17 | +# Install from PyPI (when available) |
| 18 | +pip install seagliderOG1 |
| 19 | + |
| 20 | +# Or install from source |
| 21 | +pip install git+https://github.com/ocean-uhh/seagliderOG1.git |
| 22 | +``` |
| 23 | + |
| 24 | +### Development setup |
| 25 | + |
| 26 | +For contributors and developers: |
| 27 | + |
| 28 | +```bash |
| 29 | +# Clone the repository |
| 30 | +git clone https://github.com/ocean-uhh/seagliderOG1.git |
| 31 | +cd seagliderOG1 |
| 32 | + |
| 33 | +# Install dependencies and package in development mode |
| 34 | +pip install -r requirements-dev.txt |
| 35 | +pip install -e . |
| 36 | +``` |
| 37 | + |
| 38 | +### Alternative: Using conda/micromamba |
| 39 | + |
| 40 | +If you prefer conda environments: |
| 41 | + |
| 42 | +```bash |
| 43 | +# Using conda |
| 44 | +conda env create -f environment.yml |
| 45 | +conda activate TEST |
| 46 | + |
| 47 | +# Using micromamba (faster) |
| 48 | +micromamba env create -f environment.yml |
| 49 | +micromamba activate TEST |
| 50 | +``` |
| 51 | + |
| 52 | +## Package Structure |
| 53 | + |
| 54 | +Scripts within the `seagliderOG1` package are organized by functionality: |
| 55 | + |
| 56 | +- **readers.py** - Reads basestation files (`*.nc`) from server or local directory |
| 57 | +- **writers.py** - Writes OG1 `*.nc` files to output directory (default: `data/`) |
| 58 | +- **plotters.py** - Basic plotting and data visualization functions |
| 59 | +- **convertOG1.py** - Main conversion logic from basestation to OG1 format |
| 60 | +- **vocabularies.py** - Vocabulary translation mappings for OG1 compliance |
| 61 | +- **tools.py** - User-facing utility functions |
| 62 | +- **utilities.py** - Internal helper functions for data processing |
| 63 | + |
| 64 | +## Configuration |
| 65 | + |
| 66 | +The `config/` directory contains YAML files that define OG1 format specifications: |
| 67 | + |
| 68 | +- `OG1_global_attrs.yaml` - Global attributes for OG1 format |
| 69 | +- `OG1_var_names.yaml` - Variable name mappings |
| 70 | +- `OG1_sensor_attrs.yaml` - Sensor attribute definitions |
| 71 | +- `OG1_vocab_attrs.yaml` - Vocabulary attribute mappings |
| 72 | +- `OG1_author.yaml` - Author information template |
| 73 | +- `mission_yaml.yaml` - Mission configuration template |
| 74 | + |
| 75 | +## Usage |
| 76 | + |
| 77 | +### Basic conversion |
| 78 | + |
| 79 | +```python |
| 80 | +from seagliderOG1 import convertOG1, readers |
| 81 | + |
| 82 | +# Load basestation files |
| 83 | +datasets = readers.load_basestation_files("path/to/basestation/files/") |
| 84 | + |
| 85 | +# Convert to OG1 format |
| 86 | +og1_dataset, variable_list = convertOG1.convert_to_OG1(datasets) |
| 87 | + |
| 88 | +# Save result |
| 89 | +from seagliderOG1 import writers |
| 90 | +writers.save_dataset(og1_dataset, "output_file.nc") |
| 91 | +``` |
| 92 | + |
| 93 | +### Examples |
| 94 | + |
| 95 | +See the `notebooks/` directory for detailed examples: |
| 96 | +- `demo.ipynb` - Basic usage demonstration |
| 97 | +- `dev_notebooks/` - Development and troubleshooting notebooks |
| 98 | + |
| 99 | +## Development |
| 100 | + |
| 101 | +### Running tests |
| 102 | + |
| 103 | +```bash |
| 104 | +pytest # Run all tests |
| 105 | +pytest -v # Verbose output |
| 106 | +pytest tests/test_*.py # Run specific test file |
| 107 | +``` |
| 108 | + |
| 109 | +### Code quality |
| 110 | + |
| 111 | +```bash |
| 112 | +black . # Format code |
| 113 | +ruff check --fix # Lint and auto-fix |
| 114 | +pre-commit run --all-files # Run all pre-commit hooks |
| 115 | +``` |
| 116 | + |
| 117 | +### Building documentation |
| 118 | + |
| 119 | +```bash |
| 120 | +cd docs |
| 121 | +make clean html |
| 122 | +``` |
| 123 | + |
| 124 | +## Dependencies |
| 125 | + |
| 126 | +The project uses different dependency files for different use cases: |
| 127 | + |
| 128 | +- **requirements.txt** - Core runtime dependencies (recommended for most users) |
| 129 | +- **requirements-dev.txt** - Additional development tools (testing, documentation, code quality) |
| 130 | +- **environment.yml** - Complete conda/micromamba environment (alternative for conda users) |
| 131 | + |
| 132 | +### Core dependencies |
| 133 | + |
| 134 | +- **xarray** & **netCDF4** - NetCDF file handling and data manipulation |
| 135 | +- **numpy**, **pandas** - Numerical operations and data structures |
| 136 | +- **gsw** - Seawater property calculations (TEOS-10) |
| 137 | +- **matplotlib** - Plotting and visualization |
| 138 | +- **pooch** - Data downloading and caching |
| 139 | + |
| 140 | +## Contributing |
| 141 | + |
| 142 | +1. Fork the repository |
| 143 | +2. Create a feature branch (`git checkout -b feature/amazing-feature`) |
| 144 | +3. Make your changes |
| 145 | +4. Run tests and ensure they pass |
| 146 | +5. Commit your changes (`git commit -m 'Add amazing feature'`) |
| 147 | +6. Push to the branch (`git push origin feature/amazing-feature`) |
| 148 | +7. Open a Pull Request |
| 149 | + |
| 150 | +## Status |
| 151 | + |
| 152 | +This project is under active development. Collaborations and contributions are welcome! |
| 153 | + |
| 154 | +## License |
| 155 | + |
| 156 | +See [LICENSE](LICENSE) for details. |
0 commit comments