|
| 1 | +# Using the GeoZarr Converter |
| 2 | + |
| 3 | +The GeoZarr converter provides tools to transform EOPF datasets into GeoZarr-spec 0.4 compliant format. This guide explains how to use the converter effectively. |
| 4 | + |
| 5 | +## Command Line Interface |
| 6 | + |
| 7 | +The converter can be accessed via the `eopf-geozarr` command-line tool. Below are some common use cases: |
| 8 | + |
| 9 | +### Basic Conversion |
| 10 | + |
| 11 | +Convert an EOPF dataset to GeoZarr format: |
| 12 | + |
| 13 | +```bash |
| 14 | +eopf-geozarr convert input.zarr output.zarr |
| 15 | +``` |
| 16 | + |
| 17 | +### S3 Output |
| 18 | + |
| 19 | +Convert and save the output directly to an S3 bucket: |
| 20 | + |
| 21 | +```bash |
| 22 | +eopf-geozarr convert input.zarr s3://my-bucket/output.zarr |
| 23 | +``` |
| 24 | + |
| 25 | +### Parallel Processing |
| 26 | + |
| 27 | +Enable parallel processing for large datasets using a Dask cluster: |
| 28 | + |
| 29 | +```bash |
| 30 | +eopf-geozarr convert input.zarr output.zarr --dask-cluster |
| 31 | +``` |
| 32 | + |
| 33 | +### Validation |
| 34 | + |
| 35 | +Validate the GeoZarr compliance of a dataset: |
| 36 | + |
| 37 | +```bash |
| 38 | +eopf-geozarr validate output.zarr |
| 39 | +``` |
| 40 | + |
| 41 | +## Python API |
| 42 | + |
| 43 | +The converter also provides a Python API for programmatic usage: |
| 44 | + |
| 45 | +### Example: Basic Conversion |
| 46 | + |
| 47 | +```python |
| 48 | +import xarray as xr |
| 49 | +from eopf_geozarr import create_geozarr_dataset |
| 50 | + |
| 51 | +# Load your EOPF DataTree |
| 52 | +dt = xr.open_datatree("path/to/eopf/dataset.zarr", engine="zarr") |
| 53 | + |
| 54 | +# Convert to GeoZarr format |
| 55 | +dt_geozarr = create_geozarr_dataset( |
| 56 | + dt_input=dt, |
| 57 | + groups=["/measurements/r10m", "/measurements/r20m", "/measurements/r60m"], |
| 58 | + output_path="path/to/output/geozarr.zarr", |
| 59 | + spatial_chunk=4096, |
| 60 | + min_dimension=256, |
| 61 | + tile_width=256, |
| 62 | + max_retries=3 |
| 63 | +) |
| 64 | +``` |
| 65 | + |
| 66 | +### Example: S3 Output |
| 67 | + |
| 68 | +```python |
| 69 | +import os |
| 70 | +from eopf_geozarr import create_geozarr_dataset |
| 71 | + |
| 72 | +# Configure S3 credentials |
| 73 | +os.environ['AWS_ACCESS_KEY_ID'] = 'your_access_key' |
| 74 | +os.environ['AWS_SECRET_ACCESS_KEY'] = 'your_secret_key' |
| 75 | +os.environ['AWS_DEFAULT_REGION'] = 'us-east-1' |
| 76 | + |
| 77 | +# Convert and save to S3 |
| 78 | +dt_geozarr = create_geozarr_dataset( |
| 79 | + dt_input=dt, |
| 80 | + groups=["/measurements/r10m", "/measurements/r20m", "/measurements/r60m"], |
| 81 | + output_path="s3://my-bucket/output.zarr", |
| 82 | + spatial_chunk=4096, |
| 83 | + min_dimension=256, |
| 84 | + tile_width=256, |
| 85 | + max_retries=3 |
| 86 | +) |
| 87 | +``` |
| 88 | + |
| 89 | +## Advanced Features |
| 90 | + |
| 91 | +### Chunk Alignment |
| 92 | + |
| 93 | +The converter ensures proper chunk alignment to optimize storage and prevent data corruption. It uses the `calculate_aligned_chunk_size` function to determine optimal chunk sizes. |
| 94 | + |
| 95 | +### Multiscale Support |
| 96 | + |
| 97 | +The converter supports multiscale datasets, creating overview levels with /2 downsampling logic. Each level is stored as a sibling group (e.g., `/0`, `/1`, `/2`). |
| 98 | + |
| 99 | +### Native CRS Preservation |
| 100 | + |
| 101 | +The converter maintains the native coordinate reference system (CRS) of the dataset, avoiding reprojection to Web Mercator. |
| 102 | + |
| 103 | +## Error Handling |
| 104 | + |
| 105 | +The converter includes robust error handling and retry logic for network operations, ensuring reliable processing even in challenging environments. |
| 106 | + |
| 107 | +For more details, refer to the [API Reference](api.md). |
0 commit comments