Skip to content

Commit 48ab41d

Browse files
authored
refresh landuse category colors
1 parent e3dd516 commit 48ab41d

1 file changed

Lines changed: 78 additions & 45 deletions

File tree

src/herbie/paint/__init__.py

Lines changed: 78 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -841,27 +841,27 @@ class Water:
841841
class MODIS21:
842842
name = "modis21"
843843
landuse = {
844-
1: {"color": "#006600", "label": "Evergreen Needleleaf Forest"},
845-
2: {"color": "#02522a", "label": "Evergreen Broadleaf Forest"},
846-
3: {"color": "#33cc33", "label": "Deciduous Needleleaf Forest"},
847-
4: {"color": "#33cc66", "label": "Deciduous Broadleaf Forest"},
848-
5: {"color": "#339933", "label": "Mixed Forests"},
849-
6: {"color": "#4cb200", "label": "Closed Shrublands"},
850-
7: {"color": "#d1691f", "label": "Open Shrublands"},
851-
8: {"color": "#bdb569", "label": "Woody Savannas"},
852-
9: {"color": "#ffd600", "label": "Savannas"},
853-
10: {"color": "#00ff00", "label": "Grasslands"},
854-
11: {"color": "#00ffff", "label": "Permanent Wetlands"},
855-
12: {"color": "#ffff00", "label": "Croplands"},
856-
13: {"color": "#ff0000", "label": "Urban and Built-Up"},
857-
14: {"color": "#b2e64c", "label": "Cropland/Natural Vegetation Mosaic"},
858-
15: {"color": "#ffffff", "label": "Snow and Ice"},
859-
16: {"color": "#e9e9b2", "label": "Barren or Sparsely Vegetated"},
860-
17: {"color": "#80b2ff", "label": "Water"},
861-
18: {"color": "#ff00bd", "label": "Wooded Tundra"},
862-
19: {"color": "#f7804f", "label": "Mixed Tundra"},
863-
20: {"color": "#e8967a", "label": "Barren Tundra"},
864-
21: {"color": "#0000e0", "label": "Lake"},
844+
1: {"color": "#1a5e1a", "label": "Evergreen Needleleaf Forest"},
845+
2: {"color": "#2d7a3a", "label": "Evergreen Broadleaf Forest"},
846+
3: {"color": "#6aaa4e", "label": "Deciduous Needleleaf Forest"},
847+
4: {"color": "#8db85a", "label": "Deciduous Broadleaf Forest"},
848+
5: {"color": "#4e8c3a", "label": "Mixed Forests"},
849+
6: {"color": "#b5874a", "label": "Closed Shrublands"},
850+
7: {"color": "#cca96e", "label": "Open Shrublands"},
851+
8: {"color": "#c4b37a", "label": "Woody Savannas"},
852+
9: {"color": "#d9c46a", "label": "Savannas"},
853+
10: {"color": "#b8d48a", "label": "Grasslands"},
854+
11: {"color": "#5ba8a0", "label": "Permanent Wetlands"},
855+
12: {"color": "#e8d48a", "label": "Croplands"},
856+
13: {"color": "#c1553a", "label": "Urban and Built-Up"},
857+
14: {"color": "#d4c47a", "label": "Cropland/Natural Vegetation Mosaic"},
858+
15: {"color": "#e8e8e8", "label": "Snow and Ice"},
859+
16: {"color": "#c8b89a", "label": "Barren or Sparsely Vegetated"},
860+
17: {"color": "#4a7ab5", "label": "Water"},
861+
18: {"color": "#7a9e6e", "label": "Wooded Tundra"},
862+
19: {"color": "#a89e7a", "label": "Mixed Tundra"},
863+
20: {"color": "#c8bea8", "label": "Barren Tundra"},
864+
21: {"color": "#2362af", "label": "Lake"},
865865
}
866866
colors = np.array([v["color"] for k, v in landuse.items()])
867867
bounds = np.array(list(landuse) + [22])
@@ -880,33 +880,33 @@ class USGS24:
880880

881881
name = "usgs24"
882882
landuse = {
883-
1: {"color": "#ff0000", "label": "Urban and Built-up Land"},
884-
2: {"color": "#ffff00", "label": "Dryland Cropland and Pasture"},
885-
3: {"color": "#ffff33", "label": "Irrigated Cropland and Pasture"},
883+
1: {"color": "#c1553a", "label": "Urban and Built-up Land"},
884+
2: {"color": "#e8d48a", "label": "Dryland Cropland and Pasture"},
885+
3: {"color": "#eddc9f", "label": "Irrigated Cropland and Pasture"},
886886
4: {
887-
"color": "#ffff4c",
887+
"color": "#d9c97f",
888888
"label": "Mixed Dryland/Irrigated Cropland and Pasture",
889889
},
890-
5: {"color": "#b2e64c", "label": "Cropland/Grassland Mosaic"},
891-
6: {"color": "#b2e64c", "label": "Cropland/Woodland Mosaic"},
892-
7: {"color": "#00ff00", "label": "Grassland"},
893-
8: {"color": "#4cb200", "label": "Shrubland"},
894-
9: {"color": "#d1691f", "label": "Mixed Shrubland/Grassland"},
895-
10: {"color": "#ffd600", "label": "Savanna"},
896-
11: {"color": "#33cc66", "label": "Deciduous Broadleaf Forest"},
897-
12: {"color": "#33cc33", "label": "Deciduous Needleleaf Forest"},
898-
13: {"color": "#006633", "label": "Evergreen Broadleaf Forest"},
899-
14: {"color": "#006600", "label": "Evergreen Needleleaf Forest"},
900-
15: {"color": "#339933", "label": "Mixed Forests"},
901-
16: {"color": "#0000e0", "label": "Water Bodies"},
902-
17: {"color": "#00ffff", "label": "Herbaceous Wetlands"},
903-
18: {"color": "#33ffff", "label": "Wooden Wetlands"},
904-
19: {"color": "#e9e9b2", "label": "Barren or Sparsely Vegetated"},
905-
20: {"color": "#db143b", "label": "Herbaceous Tundraa"},
906-
21: {"color": "#db143b", "label": "Wooded Tundra"},
907-
22: {"color": "#f7804f", "label": "Mixed Tundra"},
908-
23: {"color": "#e8967a", "label": "Barren Tundra"},
909-
24: {"color": "#ffffff", "label": "Snow and Ice"},
890+
5: {"color": "#d4c47a", "label": "Cropland/Grassland Mosaic"},
891+
6: {"color": "#cdbb6c", "label": "Cropland/Woodland Mosaic"},
892+
7: {"color": "#b8d48a", "label": "Grassland"},
893+
8: {"color": "#cca96e", "label": "Shrubland"},
894+
9: {"color": "#e0cc7f", "label": "Mixed Shrubland/Grassland"},
895+
10: {"color": "#d9c46a", "label": "Savanna"},
896+
11: {"color": "#8db85a", "label": "Deciduous Broadleaf Forest"},
897+
12: {"color": "#6aaa4e", "label": "Deciduous Needleleaf Forest"},
898+
13: {"color": "#2d7a3a", "label": "Evergreen Broadleaf Forest"},
899+
14: {"color": "#1a5e1a", "label": "Evergreen Needleleaf Forest"},
900+
15: {"color": "#4e8c3a", "label": "Mixed Forests"},
901+
16: {"color": "#4a7ab5", "label": "Water Bodies"},
902+
17: {"color": "#5ba8a0", "label": "Herbaceous Wetlands"},
903+
18: {"color": "#6fb8af", "label": "Wooden Wetlands"},
904+
19: {"color": "#c8b89a", "label": "Barren or Sparsely Vegetated"},
905+
20: {"color": "#b5ab85", "label": "Herbaceous Tundraa"},
906+
21: {"color": "#7a9e6e", "label": "Wooded Tundra"},
907+
22: {"color": "#9c9270", "label": "Mixed Tundra"},
908+
23: {"color": "#c8bea8", "label": "Barren Tundra"},
909+
24: {"color": "#e8e8e8", "label": "Snow and Ice"},
910910
}
911911
colors = np.array([v["color"] for k, v in landuse.items()])
912912
bounds = np.array(list(landuse) + [22])
@@ -919,6 +919,39 @@ class USGS24:
919919
cbar_kwargs = dict(label="USGS Landuse")
920920
cbar_kwargs2 = cbar_kwargs | dict(spacing="proportional", ticks=bounds)
921921

922+
class SOIL16:
923+
"""Colormap for 16-category Soil Dataset."""
924+
925+
name = "soil16"
926+
landuse = {
927+
1: {"color": "#d4b483", "label": "Sand"},
928+
2: {"color": "#c8a46e", "label": "Loamy Sand"},
929+
3: {"color": "#b89458", "label": "Sandy Loam"},
930+
4: {"color": "#a07840", "label": "Silt Loam"},
931+
5: {"color": "#c8b89a", "label": "Silt"},
932+
6: {"color": "#8c6430", "label": "Loam"},
933+
7: {"color": "#7a5020", "label": "Sandy Clay Loam"},
934+
8: {"color": "#6e4818", "label": "Silty Clay Loam"},
935+
9: {"color": "#603c10", "label": "Clay Loam"},
936+
10: {"color": "#543008", "label": "Sandy Clay"},
937+
11: {"color": "#482800", "label": "Silty Clay"},
938+
12: {"color": "#3c2000", "label": "Clay"},
939+
13: {"color": "#5ba8a0", "label": "Organic Material"},
940+
14: {"color": "#4a7ab5", "label": "Water"},
941+
15: {"color": "#e8e8e8", "label": "Bedrock"},
942+
16: {"color": "#c8b89a", "label": "Other/Ice"},
943+
}
944+
colors = np.array([v["color"] for k, v in landuse.items()])
945+
bounds = np.array(list(landuse) + [22])
946+
labels = np.array([f"{k} " + v["label"] for k, v in landuse.items()])
947+
cmap = mcolors.LinearSegmentedColormap.from_list(name, colors, N=len(bounds) - 1)
948+
norm = mcolors.BoundaryNorm(boundaries=bounds, ncolors=len(bounds))
949+
plt.colormaps.register(cmap, force=True)
950+
cmap = plt.get_cmap(name)
951+
kwargs = dict(cmap=cmap, norm=norm)
952+
cbar_kwargs = dict(label="Soild Categories")
953+
cbar_kwargs2 = cbar_kwargs | dict(spacing="proportional", ticks=bounds)
954+
922955

923956
# ======================================================================
924957
# Other

0 commit comments

Comments
 (0)