Skip to content

Commit

Permalink
tmp disable estimate-cu command
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklvsa committed Jan 7, 2025
1 parent 3e96d3c commit 3a758c5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 54 deletions.
52 changes: 0 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,6 @@ Note, Windows is not officially supported at this time.
Windows users need to install [GDAL](http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal) and [rasterio](http://www.lfd.uci.edu/~gohlke/pythonlibs/#rasterio).
Then `pip install 'mapbox-tilesets[estimate-area]'`

## Installing optional `estimate-cu` command

If you are using an x86 Mac or Linux machine, run:
`pip install 'mapbox-tilesets[estimate-cu]'`

Otherwise, you will need to install some dependencies.

### arm64 MacOS

If you're on an arm64 Mac (e.g., with an M1 chip), you'll need to install [GDAL](https://gdal.org/) first. On Mac, a simple way is to use [Homebrew](https://brew.sh/):

```sh
$ brew install gdal
...
$ pip install 'mapbox-tilesets[estimate-cu]'
```

### Windows

Note, Windows is not officially supported at this time.

Windows users need to install [GDAL](http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal) and [rasterio](http://www.lfd.uci.edu/~gohlke/pythonlibs/#rasterio).
Then `pip install 'mapbox-tilesets[estimate-cu]'`

## Mapbox Access Tokens

In order to use the tilesets endpoints, you need a Mapbox Access Token with `tilesets:write`, `tilesets:read`, and `tilesets:list` scopes. This is a secret token, so do not share it publicly!
Expand All @@ -95,7 +71,6 @@ export MAPBOX_ACCESS_TOKEN=my.token
- [`list-sources`](#list-sources)
- [`delete-source`](#delete-source)
- [`estimate-area`](#estimate-area)
- [`estimate-cu`](#estimate-cu)
- Recipes
- [`view-recipe`](#view-recipe)
- [`validate-recipe`](#validate-recipe)
Expand Down Expand Up @@ -247,33 +222,6 @@ Usage
tilesets delete-source user source_id
```

### estimate-cu

```shell
tilesets estimate-cu <tileset> -s/--sources <sources> -b/--num-bands <number> --raw
```

Estimates the CU value of a tileset before publishing it. This is useful to understand the estimated cost a given tileset before you start processing the data. Note: This is currently only available to tileset recipes with type `raster` or `rasterarray`.

See https://docs.mapbox.com/help/glossary/compute-unit/ for more information.

Flags:
- `-s` or `--sources` [optional]: Local path to the sources that your recipe points at. This is highly recommeneded.
- `-b` or `--num-bands` [optional]: The number of bands you expect your recipe to select across all layers. This is recommended.
- `--minzoom` [optional]: Use this flag if your recipe does not contain a minzoom value.
- `--maxzoom` [optional]: Use this flag if your recipe does not contain a maxzoom value.
- `--raw` [optional]: This will toggle the pretty print output.

Usage

```shell
# Estimate the CUs for 'account.tileset' with sources located in 'path/to/sources/' and a band count of 20.
tilesets estimate-cu account.tileset -s 'path/to/sources/*.grib2' -b 20

# Estimate the CUs for 'account.tileset' for a single source and a band count of 10 (pretty print the results)
tilesets estimate-cu account.tileset -s 'path/to/sources/helloworld.grib2' -b 10 --raw
```

### estimate-area

```shell
Expand Down
3 changes: 1 addition & 2 deletions mapbox_tilesets/scripts/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,8 +841,7 @@ def validate_stream(features):
utils.validate_geojson(index, feature)
yield feature


@cli.command("estimate-cu")
# @cli.command("estimate-cu")
@click.argument("tileset", required=True, type=str)
@click.option(
"--sources",
Expand Down
5 changes: 5 additions & 0 deletions tests/test_cli_estimate_cu.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from mapbox_tilesets.scripts.cli import estimate_cu


@pytest.mark.skip
@pytest.mark.usefixtures("token_environ")
@pytest.mark.usefixtures("api_environ")
@mock.patch("requests.Session.get")
Expand Down Expand Up @@ -34,6 +35,7 @@ def test_cli_estimate_cu_tileset_no_sources(mock_request_get, MockResponse):
)


@pytest.mark.skip
@pytest.mark.usefixtures("token_environ")
@pytest.mark.usefixtures("api_environ")
@mock.patch("requests.Session.get")
Expand Down Expand Up @@ -64,6 +66,7 @@ def test_cli_estimate_cu_tileset_with_sources_raw(
assert json.loads(result.output) == msg


@pytest.mark.skip
@pytest.mark.usefixtures("token_environ")
@pytest.mark.usefixtures("api_environ")
@mock.patch("requests.Session.get")
Expand Down Expand Up @@ -95,6 +98,7 @@ def test_cli_estimate_cu_tileset_with_sources(
)


@pytest.mark.skip
@pytest.mark.usefixtures("token_environ")
@pytest.mark.usefixtures("api_environ")
@mock.patch("requests.Session.get")
Expand Down Expand Up @@ -131,6 +135,7 @@ def test_cli_estimate_cu_tileset_with_zoom_overrides(
)


@pytest.mark.skip
@pytest.mark.usefixtures("token_environ")
@pytest.mark.usefixtures("api_environ")
@mock.patch("requests.Session.get")
Expand Down

0 comments on commit 3a758c5

Please sign in to comment.