Skip to content

Commit

Permalink
Revert "include colormap json file"
Browse files Browse the repository at this point in the history
This reverts commit a215fe0.
  • Loading branch information
smohiudd committed Nov 29, 2024
1 parent a215fe0 commit 480dbe3
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion raster_api/runtime/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

inst_reqs = [
"boto3",
"rio-tiler==7.2.2",
"rio-tiler==6.5.0",
"titiler.pgstac==1.3.0",
"titiler.core>=0.18.5,<0.19",
"titiler.mosaic>=0.18.5,<0.19",
Expand Down
11 changes: 7 additions & 4 deletions raster_api/runtime/src/cmap_data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ np.save("soil_texture.npy", cmap)

```python
from rio_tiler.colormap import parse_color
import json
import numpy as np

# Colormap for Enhanced Fujita (EF) scale ratings
tornado_ef_scale = {
Expand All @@ -128,7 +128,10 @@ tornado_ef_scale = {
"5": "#ff00ff"
}

cmap = {int(i):parse_color(tornado_ef_scale[i]) for i in tornado_ef_scale}
cmap = np.zeros((256, 4), dtype=np.uint8)
cmap[:] = np.array([0, 0, 0, 255])
for k in tornado_ef_scale.keys():
cmap[int(k)] = np.array(parse_color(tornado_ef_scale[k]))

with open('tornado_ef_scale.json', 'w') as f:
json.dump(cmap, f)
np.save("tornadoes.npy", cmap)
```
1 change: 0 additions & 1 deletion raster_api/runtime/src/cmap_data/tornado_ef_scale.json

This file was deleted.

Binary file added raster_api/runtime/src/cmap_data/tornadoes.npy
Binary file not shown.
3 changes: 1 addition & 2 deletions raster_api/runtime/src/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
# Try backported to PY<39 `importlib_resources`.
from importlib_resources import files as resources_files # type: ignore


VEDA_CMAPS_FILES = {
f.stem: str(f) for f in (resources_files(__package__) / "cmap_data").glob("*.[npy json]*") # type: ignore
f.stem: str(f) for f in (resources_files(__package__) / "cmap_data").glob("*.npy") # type: ignore
}
cmap = default_cmap.register(VEDA_CMAPS_FILES)
ColorMapParams = create_colormap_dependency(cmap)

0 comments on commit 480dbe3

Please sign in to comment.