Skip to content

Commit

Permalink
Do not overwrite GDAL_CACHEMAX if set (#338)
Browse files Browse the repository at this point in the history
* do not overwrite GDAL_CACHEMAX if set

* try updating miniconda action

* use newer mpl.colormaps object

* typo

* remove extra _r cmaps
  • Loading branch information
dionhaefner authored Jun 4, 2024
1 parent 018f963 commit c0f2959
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ jobs:
key:
${{ runner.os }}-conda-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}

- uses: conda-incubator/setup-miniconda@v2
- uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
Expand Down
7 changes: 3 additions & 4 deletions terracotta/cmaps/generate_cmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
"""

import numpy as np
import matplotlib.cm as cm
import matplotlib as mpl

from terracotta.cmaps.get_cmaps import SUFFIX

ALL_CMAPS = list(cm.cmaps_listed) + list(cm.datad)
ALL_CMAPS.extend([f"{cmap}_r" for cmap in ALL_CMAPS])
ALL_CMAPS = list(mpl.colormaps)
NUM_VALS = 255


def generate_maps(out_folder: str) -> None:
x = np.linspace(0, 1, NUM_VALS)
for cmap in ALL_CMAPS:
print(cmap)
cmap_fun = cm.get_cmap(cmap)
cmap_fun = mpl.colormaps[cmap]
cmap_vals = cmap_fun(x)
cmap_uint8 = (cmap_vals * 255).astype("uint8")
np.save(f"{out_folder}/{cmap.lower()}{SUFFIX}", cmap_uint8)
Expand Down
2 changes: 1 addition & 1 deletion terracotta/scripts/optimize_rasters.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

IN_MEMORY_THRESHOLD = 10980 * 10980

CACHEMAX = 1024 * 1024 * 512 # 512 MB
CACHEMAX = os.environ.get("GDAL_CACHEMAX", 1024 * 1024 * 512) # 512 MB

GDAL_CONFIG = {
"GDAL_TIFF_INTERNAL_MASK": True,
Expand Down

0 comments on commit c0f2959

Please sign in to comment.