Skip to content

Commit 9593f83

Browse files
authored
Merge pull request #10 from chiaweh2/develop
Develop
2 parents ee602b5 + 774a93a commit 9593f83

5 files changed

Lines changed: 568 additions & 388 deletions

File tree

‎doc/_config.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@ repository:
2727
# Add GitHub buttons to your book
2828
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository
2929
html:
30+
favicon: favicon.ico # Path to favicon relative to doc/ directory
3031
use_issues_button: true
3132
use_repository_button: true
33+
extra_navbar: ""
34+
extra_footer: ""
35+
home_page_in_navbar: false

‎doc/api_reference.md‎

Lines changed: 8 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -13,125 +13,22 @@ This section provides detailed documentation for all classes, functions, and met
1313
:show-inheritance:
1414
1515
```
16+
### Index Store Module
1617

17-
18-
The main class for creating and managing spatial binning operations.
19-
20-
#### Constructor Parameters
21-
22-
- **ds_high** (*xarray.Dataset*): High-resolution input dataset
23-
- **ds_low** (*xarray.Dataset*): Low-resolution target grid dataset
24-
- **var_name** (*str*): Name of the variable to bin
25-
- **radius** (*float, optional*): Search radius for binning algorithm
26-
27-
#### Key Methods
28-
29-
##### create_binning_index()
30-
Creates a binning index that maps high-resolution points to low-resolution grid cells.
31-
32-
**Returns**: Binning index object for reuse
33-
34-
##### mean_binning()
35-
Performs mean binning operation.
36-
37-
**Parameters**:
38-
- **precomputed_binning_index** (*bool, optional*): Whether to use a precomputed binning index. Defaults to False.
39-
40-
**Returns**: *xarray.Dataset* with binned results
41-
42-
**Usage Example**:
43-
```python
44-
>>> import xarray as xr
45-
>>> from map_binning.binning import Binning
46-
>>> ds_high = xr.open_dataset('high_res_data.nc')
47-
>>> ds_low = xr.open_dataset('low_res_grid.nc')
48-
>>> binning = Binning(ds_high, ds_low, var_name='temperature')
49-
>>> binned_data = binning.mean_binning()
50-
>>> print(binned_data)
18+
```{eval-rst}
19+
.. autoclass:: map_binning.index_store
20+
:members:
21+
:undoc-members:
22+
:show-inheritance:
5123
```
5224

53-
## Utility Functions
5425

55-
### save()
26+
## Utility Functions
5627

5728
```{eval-rst}
5829
.. autofunction:: map_binning.save
5930
```
6031

61-
Save binning indices or results to disk for later use.
62-
63-
**Parameters**:
64-
- **obj**: Object to save (binning index or dataset)
65-
- **filepath** (*str*): Path where to save the file
66-
67-
**Example**:
68-
```python
69-
from map_binning.index_store import save
70-
save(binning_index, 'my_index.pkl')
71-
```
72-
73-
### load()
74-
7532
```{eval-rst}
7633
.. autofunction:: map_binning.load
77-
```
78-
79-
Load previously saved binning indices or results from disk.
80-
81-
**Parameters**:
82-
- **filepath** (*str*): Path to the saved file
83-
84-
**Returns**: Loaded object
85-
86-
**Example**:
87-
```python
88-
from map_binning.index_store import load
89-
index = load('my_index.pkl')
90-
```
91-
92-
## Index Store Module
93-
94-
```{eval-rst}
95-
.. automodule:: map_binning.index_store
96-
:members:
97-
:undoc-members:
98-
:show-inheritance:
99-
```
100-
101-
Module for managing persistent storage of binning indices.
102-
103-
## Constants and Configuration
104-
105-
### Default Parameters
106-
107-
- **DEFAULT_RADIUS**: By default, the search radius for binning is set to 60% of the maximum average spacing between latitude and longitude points in the low-resolution grid. This is calculated as `max(mean_lat_spacing, mean_lon_spacing) * 0.6`.
108-
109-
### Supported Save/Load Format
110-
111-
- **SUPPORTED_FORMATS**: Only pickle files (`.pkl`) generated by the package are supported for save and load operations.
112-
113-
## Error Handling
114-
115-
The package defines custom exceptions for different error conditions:
116-
117-
- **BinningError**: Base exception for binning-related errors
118-
- **InvalidDatasetError**: Raised when input datasets are invalid
119-
- **IndexError**: Raised when binning index operations fail
120-
121-
## Data Types
122-
123-
### Coordinate Systems
124-
125-
The package supports various coordinate systems and projections:
126-
127-
- Geographic coordinates (latitude/longitude)
128-
- Projected coordinate systems
129-
- Custom grid definitions
130-
131-
### Supported Data Formats
132-
133-
Input datasets can be in various formats supported by xarray:
134-
- NetCDF (.nc, .nc4)
135-
- Zarr
136-
- GRIB
137-
- HDF5
34+
```

0 commit comments

Comments
 (0)