diff --git a/cool_maps/calc.py b/cool_maps/calc.py index 4b6ee36..f61be6a 100644 --- a/cool_maps/calc.py +++ b/cool_maps/calc.py @@ -180,48 +180,6 @@ def calculate_colorbar_ticks(vmin, vmax, c0=False): return cbticks -def categorical_cmap(nc, nsc, cmap="tab10", continuous=False): - """ - Expand your colormap by changing the alpha value (opacity) of each color. - - Returns a colormap with nc*nsc different colors, - where for each category there are nsc colors of same hue. - - - From ImportanceOfBeingErnest - https://stackoverflow.com/a/47232942/2643708 - - Args: - nc (int): number of categories (colors) - nsc (int): number of subcategories (shades for each color) - cmap (str, optional): matplotlib colormap. Defaults to "tab10". - continuous (bool, optional): _description_. Defaults to False. - - Raises: - ValueError: Too many categories for colormap - - Returns: - object: matplotlib colormap - """ - - if nc > plt.get_cmap(cmap).N: - raise ValueError("Too many categories for colormap.") - if continuous: - ccolors = plt.get_cmap(cmap)(np.linspace(0,1,nc)) - else: - ccolors = plt.get_cmap(cmap)(np.arange(nc, dtype=int)) - cols = np.zeros((nc*nsc, 3)) - for i, c in enumerate(ccolors): - chsv = matplotlib.colors.rgb_to_hsv(c[:3]) - arhsv = np.tile(chsv,nsc).reshape(nsc,3) - arhsv[:,1] = np.linspace(chsv[1],0.25,nsc) - arhsv[:,2] = np.linspace(chsv[2],1,nsc) - rgb = matplotlib.colors.hsv_to_rgb(arhsv) - cols[i*nsc:(i+1)*nsc,:] = rgb - cmap = matplotlib.colors.ListedColormap(cols) - return cmap - - def dd2dms(vals): """ Convert decimal degrees to degree-minute-second diff --git a/cool_maps/plot.py b/cool_maps/plot.py index 95f0773..f38f662 100644 --- a/cool_maps/plot.py +++ b/cool_maps/plot.py @@ -375,6 +375,7 @@ def add_ticks(ax, extent, def create(extent, proj=proj['map'], + data_proj=proj['data'], features=True, edgecolor="black", landcolor="tan", @@ -446,7 +447,7 @@ def create(extent, # Set extent before we 'add features.' This is necessary because # add_features adds land, coastlines, rivers, lakes, etc. based off # of the current extent of the window. - ax.set_extent(extent) + ax.set_extent(extent, crs=data_proj) # Create dictionary for feature arguments fargs = { diff --git a/environment_dev.yml b/environment_dev.yml index 97aaa81..54f9e69 100644 --- a/environment_dev.yml +++ b/environment_dev.yml @@ -8,5 +8,5 @@ dependencies: - matplotlib - cmocean - oceans - - numpy + - numpy<2.0 diff --git a/requirements_dev.txt b/requirements_dev.txt index 3f3bc29..429bfda 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -2,6 +2,6 @@ cartopy matplotlib cmocean oceans -numpy +numpy<2.0 jupyterlab nb_conda_kernels \ No newline at end of file diff --git a/setup.py b/setup.py index 9bed9f5..074a8d4 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ "matplotlib", "cmocean", "oceans", - "numpy", + "numpy<2.0", "erddapy" ] diff --git a/versioneer.py b/versioneer.py index 64fea1c..3aa5da3 100644 --- a/versioneer.py +++ b/versioneer.py @@ -339,9 +339,9 @@ def get_config_from_root(root): # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") - parser = configparser.SafeConfigParser() + parser = configparser.ConfigParser() with open(setup_cfg, "r") as f: - parser.readfp(f) + parser.read_file(f) VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name):