From a39137d9c31cb7dcff9c0333e61b03412d2611f0 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 11:20:20 -0600 Subject: [PATCH 01/29] use snake case for fx names --- src/geocat/viz/util.py | 190 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 9119819c..9d60588d 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -861,6 +861,62 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: + """This function is deprecated. Call `find_local_extrema` instead. + + Utility function to find local low/high field variable coordinates on a + contour map. To classify as a local high, the data point must be greater + than highval, and to classify as a local low, the data point must be less + than lowVal. + + Parameters + ---------- + da : :class:`xarray.DataArray` + Xarray data array containing the lat, lon, and field variable (ex. pressure) data values + + highVal : int + Data value that the local high must be greater than to qualify as a "local high" location. + Default highVal is 0. + + lowVal : int + Data value that the local low must be less than to qualify as a "local low" location. + Default lowVal is 1000. + + eType : str + 'Low' or 'High' + Determines which extrema are being found- minimum or maximum, respectively. + Default eType is 'Low'. + + eps : float + Parameter supplied to sklearn.cluster.DBSCAN determining the maximum distance between two samples + for one to be considered as in the neighborhood of the other. + Default eps is 10. + + Returns + ------- + clusterExtremas : list + List of coordinate tuples in GPS form (lon in degrees, lat in degrees) + that specify local low/high locations + + Examples + -------- + All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the `website `_. + + - `NCL_sat_1.py `_ + + - `NCL_sat_2.py `_ + """ + + warnings.warn( + "This function is deprecated. Call `find_local_extrema` instead.") + + return find_local_extrema(da, highVal, lowVal, eType, eps) + + +def find_local_extrema(da: xr.DataArray, + highVal: int = 0, + lowVal: int = 1000, + eType: str = 'Low', + eps: float = 10) -> list: """Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater than highval, and to classify as a local low, the data point must be less @@ -983,6 +1039,71 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: + """This function is deprecated. Call `plot_contour_labels` instead. + + Utility function to plot contour labels by passing in a coordinate to + the clabel function. + + This allows the user to specify the exact locations of the labels, rather than having matplotlib + plot them automatically. + + + Parameters + ---------- + ax : :class:`matplotlib.axes.Axes` + Axis containing the contour set. + + contours : :class:`matplotlib.contour.QuadContourSet` + Contour set that is being labeled. + + transform : :class:`cartopy.crs.CRS` + Instance of CRS that represents the source coordinate system of coordinates. + (ex. ccrs.Geodetic()). + + proj : :class:`cartopy.crs.CRS` + Projection 'ax' is defined by. + This is the instance of CRS that the coordinates will be transformed to. + + clabel_locations : list + List of coordinate tuples in GPS form (lon in degrees, lat in degrees) + that specify where the contours with regular field variable values should be plotted. + + fontsize : int + Font size of contour labels. + + whitebbox : bool + Setting this to "True" will cause all labels to be plotted with white backgrounds + + horizontal : bool + Setting this to "True" will cause the contour labels to be horizontal. + + Returns + ------- + cLabels : list + List of text instances of all contour labels + + Examples + -------- + All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the `website `_. + + - `NCL_sat_1.py `_ + """ + + warnings.warn( + "This function is deprecated. Call `plot_contour_labels` instead.") + + return plot_contour_labels(ax, contours, transform, proj, clabel_locations, + fontsize, whitebbox, horizontal) + + +def plot_contour_labels(ax: matplotlib.axes.Axes, + contours, + transform: cartopy.crs.CRS, + proj: cartopy.crs.CRS, + clabel_locations: list = [], + fontsize: int = 12, + whitebbox: bool = False, + horizontal: bool = False) -> list: """Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1068,6 +1189,75 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: + """This function is deprecated. Please use `plot_extrema_contour_labels` + instead. + + Utility function to plot contour labels. + + High/Low contour labels will be plotted using text boxes for more accurate label values + and placement. + This function is exemplified in the python version of https://www.ncl.ucar.edu/Applications/Images/sat_1_lg.png + + Parameters + ---------- + da : :class:`xarray.DataArray` + Xarray data array containing the lat, lon, and field variable data values. + + transform : :class:`cartopy.crs.CRS` + Instance of CRS that represents the source coordinate system of coordinates. + (ex. ccrs.Geodetic()). + + proj : :class:`cartopy.crs.CRS` + Projection 'ax' is defined by. + This is the instance of CRS that the coordinates will be transformed to. + + clabel_locations : list + List of coordinate tuples in GPS form (lon in degrees, lat in degrees) + that specify where the contour labels should be plotted. + + label : str + ex. 'L' or 'H' + The data value will be plotted as a subscript of this label. + + fontsize : int + Font size of regular contour labels. + + horizontal : bool + Setting this to "True" will cause the contour labels to be horizontal. + + whitebbox : bool + Setting this to "True" will cause all labels to be plotted with white backgrounds + + Returns + ------- + extremaLabels : list + List of text instances of all contour labels + + Examples + -------- + All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the `website `_. + + - `NCL_sat_1.py `_ + + - `NCL_sat_2.py `_ + """ + + warnings.warn( + "This function is deprecated. Please use `plot_extrema_contour_labels` instead." + ) + + return plot_extrema_contour_labels(da, transform, proj, clabel_locations, + label, fontsize, whitebbox, horizontal) + + +def plot_extrema_contour_labels(da: xr.DataArray, + transform: cartopy.crs.CRS, + proj: cartopy.crs.CRS, + clabel_locations: list = [], + label: str = 'L', + fontsize: int = 22, + whitebbox: bool = False, + horizontal: bool = True) -> list: """Utility function to plot contour labels. High/Low contour labels will be plotted using text boxes for more accurate label values From 90ab4da92a79fe9460b4f800e5cd9841246767b7 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 11:32:49 -0600 Subject: [PATCH 02/29] add check for variable and function name conventions to pre-commit --- .github/workflows/pre-commit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 5bee9aed..385a99eb 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,4 +12,5 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - - uses: pre-commit/action@v2.0.3 + - run: pip install flake8 flake8-variables-names + - run: flake8 --select=VNE --show-source --statistics . From 59990b71709a398fd535da95c66fe3dbb1964412 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 11:39:31 -0600 Subject: [PATCH 03/29] pep8 --- docs/conf.py | 68 ++++++++++++++++++++---------------------- src/geocat/viz/util.py | 6 ++-- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index e17a7684..7aa83253 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,6 +12,8 @@ # # -- Project information ----------------------------------------------------- +import datetime +import geocat.viz as gv import os import sys import pathlib @@ -22,8 +24,6 @@ print("sys.path:", sys.path) -import geocat.viz as gv - LOGGER = logging.getLogger("conf") try: @@ -45,12 +45,12 @@ def __getattr__(cls, name): # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -67,7 +67,7 @@ def __getattr__(cls, name): 'sphinx.ext.extlinks', ] -#mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" +# mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" intersphinx_mapping = { 'dask': ('https://docs.dask.org/en/latest/', None), @@ -136,7 +136,7 @@ def __getattr__(cls, name): } # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' @@ -144,8 +144,6 @@ def __getattr__(cls, name): # General information about the project. project = u'GeoCAT-viz' -import datetime - current_year = datetime.datetime.now().year copyright = u'{}, University Corporation for Atmospheric Research'.format( current_year) @@ -165,9 +163,9 @@ def __getattr__(cls, name): # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -176,27 +174,27 @@ def __getattr__(cls, name): # The reST default role (used for this markup: `text`) to use for all # documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False +# keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -230,14 +228,14 @@ def __getattr__(cls, name): ) # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. # " v documentation" by default. -#html_title = u'geocat-viz v0.1' +# html_title = u'geocat-viz v0.1' # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -257,64 +255,64 @@ def __getattr__(cls, name): # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +# html_extra_path = [] # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. -#html_last_updated_fmt = None +# html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' -#html_search_language = 'en' +# html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # 'ja' uses this config value. # 'zh' user can custom change `jieba` dictionary path. -#html_search_options = {'type': 'default'} +# html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -#html_search_scorer = 'scorer.js' +# html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'geocat-vizdoc' diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 9d60588d..30db5ba5 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -833,7 +833,8 @@ def set_map_boundary(ax: matplotlib.axes.Axes, [(lon_range[1], lat) for lat in range(lat_range[0], lat_range[1] + 1, res)] + \ [(lon, lat_range[1]) for lon in range(lon_range[1], -180 - 1, -res)] + \ [(lon, lat_range[1]) for lon in range(180, lon_range[0] - 1, -res)] + \ - [(lon_range[0], lat) for lat in range(lat_range[1], lat_range[0] - 1, -res)] + [(lon_range[0], lat) + for lat in range(lat_range[1], lat_range[0] - 1, -res)] path = mpath.Path(vertices) elif ((lon_range[0] == 180 or lon_range[0] == -180) and (lon_range[1] == 180 or lon_range[1] == -180)): @@ -843,7 +844,8 @@ def set_map_boundary(ax: matplotlib.axes.Axes, vertices = [(lon, lat_range[0]) for lon in range(lon_range[0], lon_range[1] + 1, res)] + \ [(lon_range[1], lat) for lat in range(lat_range[0], lat_range[1] + 1, res)] + \ [(lon, lat_range[1]) for lon in range(lon_range[1], lon_range[0] - 1, -res)] + \ - [(lon_range[0], lat) for lat in range(lat_range[1], lat_range[0] - 1, -res)] + [(lon_range[0], lat) + for lat in range(lat_range[1], lat_range[0] - 1, -res)] path = mpath.Path(vertices) proj_to_data = ccrs.PlateCarree()._as_mpl_transform(ax) - ax.transData From aa44cb2fc53ded88dac6e9522e031168120a4dab Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 11:58:44 -0600 Subject: [PATCH 04/29] change variable names to be happy with new flake8 rule --- .github/workflows/pre-commit.yml | 2 +- src/geocat/viz/taylor.py | 38 +++++++++++------------ src/geocat/viz/util.py | 52 ++++++++++++++++---------------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 385a99eb..03e3ebf7 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,4 +13,4 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - run: pip install flake8 flake8-variables-names - - run: flake8 --select=VNE --show-source --statistics . + - run: flake8 --select=VNE --show-source --statistics --ignore VNE003 . diff --git a/src/geocat/viz/taylor.py b/src/geocat/viz/taylor.py index 3100a89a..f4abde50 100644 --- a/src/geocat/viz/taylor.py +++ b/src/geocat/viz/taylor.py @@ -159,20 +159,20 @@ def __init__(self, self.ax = ax.get_aux_axes(tr) # Polar coordinates # Add reference point stddev contour - t = np.linspace(0, np.pi / 2) - r = np.zeros_like(t) + self.refstd - h, = self.ax.plot(t, - r, - linewidth=1, - linestyle=(0, (9, 5)), - color='black', - zorder=1) + t_array = np.linspace(0, np.pi / 2) + r_array = np.zeros_like(t_array) + self.refstd + h_plot, = self.ax.plot(t_array, + r_array, + linewidth=1, + linestyle=(0, (9, 5)), + color='black', + zorder=1) # Set aspect ratio self.ax.set_aspect('equal') # Store the reference line - self.referenceLine = h + self.referenceLine = h_plot # Collect sample points for latter use (e.g. legend) self.modelMarkerSet = [] @@ -317,8 +317,8 @@ def add_model_set(self, else: label = kwargs.get('label') if percent_bias_on: - handle = plt.scatter(1, 2, color=color, label=label) - self.modelMarkerSet.append(handle) + plot_handle = plt.scatter(1, 2, color=color, label=label) + self.modelMarkerSet.append(plot_handle) # Annotate model markers if annotate_on is True if annotate_on: @@ -461,15 +461,15 @@ def add_ygrid(self, - `NCL_taylor_2.py `_ """ - t = np.linspace(0, np.pi / 2) + t_array = np.linspace(0, np.pi / 2) for value in arr: - r = np.zeros_like(t) + value - h, = self.ax.plot(t, - r, - color=color, - linestyle=linestyle, - linewidth=linewidth, - **kwargs) + r_array = np.zeros_like(t_array) + value + h_plot, = self.ax.plot(t_array, + r_array, + color=color, + linestyle=linestyle, + linewidth=linewidth, + **kwargs) def add_grid(self, *args, **kwargs): """Add a grid. diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 30db5ba5..27527826 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -639,7 +639,7 @@ def set_axes_limits_and_ticks( def truncate_colormap(cmap: matplotlib.colors.Colormap, minval: typing.Union[int, float] = 0.0, maxval: typing.Union[int, float] = 1.0, - n: int = 100, + num_values: int = 100, name: str = None): """Utility function that truncates a colormap. Registers the new colormap by name in plt.cm, and also returns the updated map. @@ -657,7 +657,7 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, maxval : int, float Maximum value to be used for truncation of the color map. - n : int + num_values : int Number of color values in the new color map. name : str @@ -682,7 +682,7 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, b=maxval) new_cmap = mpl.colors.LinearSegmentedColormap.from_list( name=name, - colors=cmap(np.linspace(minval, maxval, n)), + colors=cmap(np.linspace(minval, maxval, num_values)), ) cm.register_cmap(name, new_cmap) return new_cmap @@ -1012,19 +1012,19 @@ def find_local_extrema(da: xr.DataArray, for key in coordsAndLabels: # Create array to hold all the field variable values for that cluster - datavals = [] + data_vals = [] for coord in coordsAndLabels[key]: # Find pressure data at that coordinate cond = np.logical_and(coordarr[:, :, 0] == coord[0], coordarr[:, :, 1] == coord[1]) x, y = np.where(cond) - datavals.append(da.data[x[0]][y[0]]) + data_vals.append(da.data[x[0]][y[0]]) # Find the index of the smallest/greatest field variable value of each cluster if eType == 'Low': - index = np.argmin(np.array(datavals)) + index = np.argmin(np.array(data_vals)) if eType == 'High': - index = np.argmax(np.array(datavals)) + index = np.argmax(np.array(data_vals)) # Append the coordinate corresponding to that index to the array to be returned clusterExtremas.append( @@ -1328,19 +1328,19 @@ def plot_extrema_contour_labels(da: xr.DataArray, np.array([x[1] for x in clabel_locations])) transformed_locations = [(x[0], x[1]) for x in clabel_points] - for x in range(len(transformed_locations)): + for loc in range(len(transformed_locations)): try: # Find field variable data at that coordinate - coord = clabel_locations[x] + coord = clabel_locations[loc] cond = np.logical_and(coordarr[:, :, 0] == coord[0], coordarr[:, :, 1] == coord[1]) - z, y = np.where(cond) - p = int(round(da.data[z[0]][y[0]])) + z_loc, y_loc = np.where(cond) + p_loc = int(round(da.data[z_loc[0]][y_loc[0]])) - lab = plt.text(transformed_locations[x][0], - transformed_locations[x][1], - label + "$_{" + str(p) + "}$", + lab = plt.text(transformed_locations[loc][0], + transformed_locations[loc][1], + label + "$_{" + str(p_loc) + "}$", fontsize=fontsize, horizontalalignment='center', verticalalignment='center') @@ -1432,19 +1432,19 @@ def set_vector_density(data: xr.DataArray, return ds -def get_skewt_vars(p: Quantity, tc: Quantity, tdc: Quantity, - pro: Quantity) -> str: +def get_skewt_vars(pressure: Quantity, temp_parcel: Quantity, + temp_dewpoint: Quantity, pro: Quantity) -> str: """This function processes the dataset values and returns a string element which can be used as a subtitle to replicate the styles of NCL Skew-T Diagrams. Parameters ---------- - p : :class:`pint.Quantity` + pressure : :class:`pint.Quantity` Pressure level input from dataset - tc : :class:`pint.Quantity` + temp_parcel : :class:`pint.Quantity` Temperature for parcel from dataset - tdc : :class:`pint.Quantity` + temp_dewpoint : :class:`pint.Quantity` Dew point temperature for parcel from dataset pro : :class:`pint.Quantity` Parcel profile temperature converted to degC @@ -1473,32 +1473,32 @@ def get_skewt_vars(p: Quantity, tc: Quantity, tdc: Quantity, """ # CAPE - cape = mpcalc.cape_cin(p, tc, tdc, pro) + cape = mpcalc.cape_cin(pressure, temp_parcel, temp_dewpoint, pro) cape = cape[0].magnitude # Precipitable Water - pwat = mpcalc.precipitable_water(p, tdc) + pwat = mpcalc.precipitable_water(pressure, temp_dewpoint) pwat = (pwat.magnitude / 10) * units.cm # Convert mm to cm pwat = pwat.magnitude # Pressure and temperature of lcl - lcl = mpcalc.lcl(p[0], tc[0], tdc[0]) + lcl = mpcalc.lcl(pressure[0], temp_parcel[0], temp_dewpoint[0]) plcl = lcl[0].magnitude tlcl = lcl[1].magnitude # Showalter index - shox = mpcalc.showalter_index(p, tc, tdc) + shox = mpcalc.showalter_index(pressure, temp_parcel, temp_dewpoint) shox = shox[0].magnitude # Place calculated values in iterable list - vals = [plcl, tlcl, shox, pwat, cape] - vals = np.round(vals).astype(int) + val_list = [plcl, tlcl, shox, pwat, cape] + val_ints = np.round(val_list).astype(int) # Define variable names for calculated values names = ['Plcl=', 'Tlcl[C]=', 'Shox=', 'Pwat[cm]=', 'Cape[J]='] # Combine the list of values with their corresponding labels - lst = list(chain.from_iterable(zip(names, vals))) + lst = list(chain.from_iterable(zip(names, val_ints))) lst = map(str, lst) # Create one large string for later plotting use From c223ee1204f2fbe7e4acbf4ba1189f1544ba7345 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 12:01:47 -0600 Subject: [PATCH 05/29] add snakecase rule --- .github/workflows/pre-commit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 03e3ebf7..e8a6a8bf 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,4 +13,4 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - run: pip install flake8 flake8-variables-names - - run: flake8 --select=VNE --show-source --statistics --ignore VNE003 . + - run: flake8 --select=VNE,N802 --show-source --statistics --ignore VNE003 . From bd58c85d9445064e05ea3ff7e4283b846c416c8e Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 12:06:11 -0600 Subject: [PATCH 06/29] undo auatopep8 changes to conf --- docs/conf.py | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7aa83253..5cb1b961 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -45,12 +45,12 @@ def __getattr__(cls, name): # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -# sys.path.insert(0, os.path.abspath('.')) +#sys.path.insert(0, os.path.abspath('.')) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. -# needs_sphinx = '1.0' +#needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom @@ -67,7 +67,7 @@ def __getattr__(cls, name): 'sphinx.ext.extlinks', ] -# mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" +#mathjax_path = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-MML-AM_CHTML" intersphinx_mapping = { 'dask': ('https://docs.dask.org/en/latest/', None), @@ -128,7 +128,7 @@ def __getattr__(cls, name): # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: -# source_suffix = ['.rst', '.md'] +#source_suffix = ['.rst', '.md'] source_suffix = { '.rst': 'restructuredtext', '.ipynb': 'myst-nb', @@ -136,7 +136,7 @@ def __getattr__(cls, name): } # The encoding of source files. -# source_encoding = 'utf-8-sig' +#source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' @@ -163,9 +163,9 @@ def __getattr__(cls, name): # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -# today = '' +#today = '' # Else, today_fmt is used as the format for a strftime call. -# today_fmt = '%B %d, %Y' +#today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -174,27 +174,27 @@ def __getattr__(cls, name): # The reST default role (used for this markup: `text`) to use for all # documents. -# default_role = None +#default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -# add_function_parentheses = True +#add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -# add_module_names = True +#add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -# show_authors = False +#show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] +#modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False +#keep_warnings = False # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False @@ -228,14 +228,14 @@ def __getattr__(cls, name): ) # Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] +#html_theme_path = [] # The name for this set of Sphinx documents. # " v documentation" by default. -# html_title = u'geocat-viz v0.1' +#html_title = u'geocat-viz v0.1' # A shorter title for the navigation bar. Default is the same as html_title. -# html_short_title = None +#html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -255,64 +255,64 @@ def __getattr__(cls, name): # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -# html_extra_path = [] +#html_extra_path = [] # If not None, a 'Last updated on:' timestamp is inserted at every page # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. -# html_last_updated_fmt = None +#html_last_updated_fmt = None # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -# html_use_smartypants = True +#html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -# html_sidebars = {} +#html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -# html_additional_pages = {} +#html_additional_pages = {} # If false, no module index is generated. -# html_domain_indices = True +#html_domain_indices = True # If false, no index is generated. -# html_use_index = True +#html_use_index = True # If true, the index is split into individual pages for each letter. -# html_split_index = False +#html_split_index = False # If true, links to the reST sources are added to the pages. -# html_show_sourcelink = True +#html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# html_show_sphinx = True +#html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# html_show_copyright = True +#html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -# html_use_opensearch = '' +#html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None +#html_file_suffix = None # Language to be used for generating the HTML full-text search index. # Sphinx supports the following languages: # 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' # 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' -# html_search_language = 'en' +#html_search_language = 'en' # A dictionary with options for the search language support, empty by default. # 'ja' uses this config value. # 'zh' user can custom change `jieba` dictionary path. -# html_search_options = {'type': 'default'} +#html_search_options = {'type': 'default'} # The name of a javascript file (relative to the configuration directory) that # implements a search results scorer. If empty, the default will be used. -# html_search_scorer = 'scorer.js' +#html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. htmlhelp_basename = 'geocat-vizdoc' @@ -324,7 +324,7 @@ def __getattr__(cls, name): nb_execution_mode = "off" # generate warning for all invalid links -# nitpicky = True +#nitpicky = True # Allow for changes to be made to the css in the theme_overrides file From 5f85863f0e8a4e0e94e036e6b8cab5c30f535ed3 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 12:08:35 -0600 Subject: [PATCH 07/29] add line back --- .github/workflows/pre-commit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index e8a6a8bf..61463fc9 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,5 +12,6 @@ jobs: steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 + - uses: pre-commit/action@v2.0.3 - run: pip install flake8 flake8-variables-names - run: flake8 --select=VNE,N802 --show-source --statistics --ignore VNE003 . From 557a40f824767a168bda68b2fa889ef55df94e75 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 14:47:10 -0600 Subject: [PATCH 08/29] add n kwarg back in, to be depricated in two release cycles --- src/geocat/viz/util.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 27527826..9e295c87 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -639,6 +639,7 @@ def set_axes_limits_and_ticks( def truncate_colormap(cmap: matplotlib.colors.Colormap, minval: typing.Union[int, float] = 0.0, maxval: typing.Union[int, float] = 1.0, + n: int = 100, num_values: int = 100, name: str = None): """Utility function that truncates a colormap. Registers the new colormap @@ -659,6 +660,7 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, num_values : int Number of color values in the new color map. + Replacing to be deprecated kwarg `n`. name : str Optional name of the new color map. If not set, a new name is generated by using the name of the input @@ -680,6 +682,11 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, name = "trunc({n},{a:.2f},{b:.2f})".format(n=cmap.name, a=minval, b=maxval) + + if n and not num_values: + warnings.warn("Keword argument `n` is deprecated. Please use `num_values` instead") + num_values = n + new_cmap = mpl.colors.LinearSegmentedColormap.from_list( name=name, colors=cmap(np.linspace(minval, maxval, num_values)), From d1d09bb540e59427e9d2cf906abb721b399aca4f Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 14:48:38 -0600 Subject: [PATCH 09/29] pre-commit --- src/geocat/viz/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 9e295c87..ffcc9637 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -682,9 +682,11 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, name = "trunc({n},{a:.2f},{b:.2f})".format(n=cmap.name, a=minval, b=maxval) - + if n and not num_values: - warnings.warn("Keword argument `n` is deprecated. Please use `num_values` instead") + warnings.warn( ++ "Keword argument `n` is deprecated. Please use `num_values` instead" ++ ) num_values = n new_cmap = mpl.colors.LinearSegmentedColormap.from_list( From c14d505a17b1bc7d30abc300bbb377af927d5f60 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 14:49:44 -0600 Subject: [PATCH 10/29] oops --- src/geocat/viz/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index ffcc9637..1046b314 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -685,8 +685,8 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, if n and not num_values: warnings.warn( -+ "Keword argument `n` is deprecated. Please use `num_values` instead" -+ ) + "Keword argument `n` is deprecated. Please use `num_values` instead" + ) num_values = n new_cmap = mpl.colors.LinearSegmentedColormap.from_list( From 8a786e8c4257f0171e13c313ad848a2a5836375f Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 15:37:12 -0600 Subject: [PATCH 11/29] ignore one letter char name rule for now --- .github/workflows/pre-commit.yml | 2 +- src/geocat/viz/util.py | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 61463fc9..277ff096 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -14,4 +14,4 @@ jobs: - uses: actions/setup-python@v3 - uses: pre-commit/action@v2.0.3 - run: pip install flake8 flake8-variables-names - - run: flake8 --select=VNE,N802 --show-source --statistics --ignore VNE003 . + - run: flake8 --select=VNE,N802 --show-source --statistics --ignore VNE001,VNE003 . diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 1046b314..b42e7c31 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -640,7 +640,6 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, minval: typing.Union[int, float] = 0.0, maxval: typing.Union[int, float] = 1.0, n: int = 100, - num_values: int = 100, name: str = None): """Utility function that truncates a colormap. Registers the new colormap by name in plt.cm, and also returns the updated map. @@ -658,9 +657,8 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, maxval : int, float Maximum value to be used for truncation of the color map. - num_values : int + n : int Number of color values in the new color map. - Replacing to be deprecated kwarg `n`. name : str Optional name of the new color map. If not set, a new name is generated by using the name of the input @@ -682,16 +680,9 @@ def truncate_colormap(cmap: matplotlib.colors.Colormap, name = "trunc({n},{a:.2f},{b:.2f})".format(n=cmap.name, a=minval, b=maxval) - - if n and not num_values: - warnings.warn( - "Keword argument `n` is deprecated. Please use `num_values` instead" - ) - num_values = n - new_cmap = mpl.colors.LinearSegmentedColormap.from_list( name=name, - colors=cmap(np.linspace(minval, maxval, num_values)), + colors=cmap(np.linspace(minval, maxval, n)), ) cm.register_cmap(name, new_cmap) return new_cmap From 5711123b822a623fc69c649b6638cb980d4c11c1 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 15:43:32 -0600 Subject: [PATCH 12/29] rename to plot_extrema_labels --- src/geocat/viz/util.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index b42e7c31..49ced771 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1191,10 +1191,10 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - """This function is deprecated. Please use `plot_extrema_contour_labels` + """This function is deprecated. Please use `plot_extrema_labels` instead. - Utility function to plot contour labels. + Utility function to plot high/low contour labels. High/Low contour labels will be plotted using text boxes for more accurate label values and placement. @@ -1245,14 +1245,14 @@ def plotELabels(da: xr.DataArray, """ warnings.warn( - "This function is deprecated. Please use `plot_extrema_contour_labels` instead." + "This function is deprecated. Please use `plot_extrema_labels` instead." ) - return plot_extrema_contour_labels(da, transform, proj, clabel_locations, + return plot_extrema_labels(da, transform, proj, clabel_locations, label, fontsize, whitebbox, horizontal) -def plot_extrema_contour_labels(da: xr.DataArray, +def plot_extrema_labels(da: xr.DataArray, transform: cartopy.crs.CRS, proj: cartopy.crs.CRS, clabel_locations: list = [], From 4b180ac6b675b61d8e7049477c283a9bc072861b Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 11 May 2023 16:02:42 -0600 Subject: [PATCH 13/29] change clabel_locations and plot skew t args --- src/geocat/viz/util.py | 45 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 49ced771..158e43e2 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1191,8 +1191,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - """This function is deprecated. Please use `plot_extrema_labels` - instead. + """This function is deprecated. Please use `plot_extrema_labels` instead. Utility function to plot high/low contour labels. @@ -1248,18 +1247,18 @@ def plotELabels(da: xr.DataArray, "This function is deprecated. Please use `plot_extrema_labels` instead." ) - return plot_extrema_labels(da, transform, proj, clabel_locations, - label, fontsize, whitebbox, horizontal) + return plot_extrema_labels(da, transform, proj, clabel_locations, label, + fontsize, whitebbox, horizontal) def plot_extrema_labels(da: xr.DataArray, - transform: cartopy.crs.CRS, - proj: cartopy.crs.CRS, - clabel_locations: list = [], - label: str = 'L', - fontsize: int = 22, - whitebbox: bool = False, - horizontal: bool = True) -> list: + transform: cartopy.crs.CRS, + proj: cartopy.crs.CRS, + label_locations: list = [], + label: str = 'L', + fontsize: int = 22, + whitebbox: bool = False, + horizontal: bool = True) -> list: """Utility function to plot contour labels. High/Low contour labels will be plotted using text boxes for more accurate label values @@ -1279,7 +1278,7 @@ def plot_extrema_labels(da: xr.DataArray, Projection 'ax' is defined by. This is the instance of CRS that the coordinates will be transformed to. - clabel_locations : list + label_locations : list List of coordinate tuples in GPS form (lon in degrees, lat in degrees) that specify where the contour labels should be plotted. @@ -1324,15 +1323,15 @@ def plot_extrema_labels(da: xr.DataArray, # Plot any low contour levels clabel_points = proj.transform_points( - transform, np.array([x[0] for x in clabel_locations]), - np.array([x[1] for x in clabel_locations])) + transform, np.array([x[0] for x in label_locations]), + np.array([x[1] for x in label_locations])) transformed_locations = [(x[0], x[1]) for x in clabel_points] for loc in range(len(transformed_locations)): try: # Find field variable data at that coordinate - coord = clabel_locations[loc] + coord = label_locations[loc] cond = np.logical_and(coordarr[:, :, 0] == coord[0], coordarr[:, :, 1] == coord[1]) z_loc, y_loc = np.where(cond) @@ -1432,8 +1431,8 @@ def set_vector_density(data: xr.DataArray, return ds -def get_skewt_vars(pressure: Quantity, temp_parcel: Quantity, - temp_dewpoint: Quantity, pro: Quantity) -> str: +def get_skewt_vars(pressure: Quantity, temperature: Quantity, + dewpoint: Quantity, pro: Quantity) -> str: """This function processes the dataset values and returns a string element which can be used as a subtitle to replicate the styles of NCL Skew-T Diagrams. @@ -1442,9 +1441,9 @@ def get_skewt_vars(pressure: Quantity, temp_parcel: Quantity, ---------- pressure : :class:`pint.Quantity` Pressure level input from dataset - temp_parcel : :class:`pint.Quantity` + temperature : :class:`pint.Quantity` Temperature for parcel from dataset - temp_dewpoint : :class:`pint.Quantity` + dewpoint : :class:`pint.Quantity` Dew point temperature for parcel from dataset pro : :class:`pint.Quantity` Parcel profile temperature converted to degC @@ -1473,21 +1472,21 @@ def get_skewt_vars(pressure: Quantity, temp_parcel: Quantity, """ # CAPE - cape = mpcalc.cape_cin(pressure, temp_parcel, temp_dewpoint, pro) + cape = mpcalc.cape_cin(pressure, temperature, dewpoint, pro) cape = cape[0].magnitude # Precipitable Water - pwat = mpcalc.precipitable_water(pressure, temp_dewpoint) + pwat = mpcalc.precipitable_water(pressure, dewpoint) pwat = (pwat.magnitude / 10) * units.cm # Convert mm to cm pwat = pwat.magnitude # Pressure and temperature of lcl - lcl = mpcalc.lcl(pressure[0], temp_parcel[0], temp_dewpoint[0]) + lcl = mpcalc.lcl(pressure[0], temperature[0], dewpoint[0]) plcl = lcl[0].magnitude tlcl = lcl[1].magnitude # Showalter index - shox = mpcalc.showalter_index(pressure, temp_parcel, temp_dewpoint) + shox = mpcalc.showalter_index(pressure, temperature, dewpoint) shox = shox[0].magnitude # Place calculated values in iterable list From db3d29c02c91202bda02cb3bcd4d6b9f790de89a Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 09:21:29 -0600 Subject: [PATCH 14/29] no more flake8 --- .github/workflows/pre-commit.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 277ff096..5bee9aed 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -13,5 +13,3 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-python@v3 - uses: pre-commit/action@v2.0.3 - - run: pip install flake8 flake8-variables-names - - run: flake8 --select=VNE,N802 --show-source --statistics --ignore VNE001,VNE003 . From 54ca5c31feda34b8b3af137de03d1e99928c8da4 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 09:28:32 -0600 Subject: [PATCH 15/29] do deprecations how comp does --- src/geocat/viz/util.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 158e43e2..26e97519 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -863,7 +863,9 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - """This function is deprecated. Call `find_local_extrema` instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to + naming conventions. Use `find_local_extrema `__ + instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -1041,7 +1043,9 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - """This function is deprecated. Call `plot_contour_labels` instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to + naming conventions. Use `plot_contour_levels `__ + instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1191,7 +1195,9 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - """This function is deprecated. Please use `plot_extrema_labels` instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to + naming conventions. Use `plot_extrema_labels `__ + instead. Utility function to plot high/low contour labels. From 1e7627923f37dc8f4c479f426d6e369432e4547b Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 09:31:55 -0600 Subject: [PATCH 16/29] add deprecated fxs to index.rst --- docs/user_api/index.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/user_api/index.rst b/docs/user_api/index.rst index ff97e86d..b7cbc012 100644 --- a/docs/user_api/index.rst +++ b/docs/user_api/index.rst @@ -51,3 +51,16 @@ GeoCAT-viz Utility Functions set_vector_density get_skewt_vars + +Deprecated Functions +-------------------- +Util +^^^^^^^^^^^^^ +.. currentmodule:: geocat.viz.util +.. autosummary:: + :nosignatures: + :toctree: ./generated/ + + findLocalExtrema + plotCLabels + plotELabels From a19416f84c4a438193309ea7624781fd3865142b Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 09:34:06 -0600 Subject: [PATCH 17/29] make link prettier --- src/geocat/viz/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 26e97519..ad28347a 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1203,7 +1203,7 @@ def plotELabels(da: xr.DataArray, High/Low contour labels will be plotted using text boxes for more accurate label values and placement. - This function is exemplified in the python version of https://www.ncl.ucar.edu/Applications/Images/sat_1_lg.png + This function is exemplified in the python version of `sat_1_lg `__ Parameters ---------- From 2d24f3450b27e0d4a611040e440755a465608db1 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 09:54:57 -0600 Subject: [PATCH 18/29] add new function names to index.rst --- docs/user_api/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/user_api/index.rst b/docs/user_api/index.rst index b7cbc012..ba6df7f1 100644 --- a/docs/user_api/index.rst +++ b/docs/user_api/index.rst @@ -42,11 +42,11 @@ GeoCAT-viz Utility Functions set_map_boundary - findLocalExtrema + find_local_extrema - plotCLabels + plot_contour_labels - plotELabels + plot_extrema_labels set_vector_density From 1763ff9531353066629179af327e35d83e13bbcf Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 09:56:29 -0600 Subject: [PATCH 19/29] deprecated box rendering weirdly --- src/geocat/viz/util.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index ad28347a..d04c37c5 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -863,9 +863,7 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to - naming conventions. Use `find_local_extrema `__ - instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -1043,9 +1041,7 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to - naming conventions. Use `plot_contour_levels `__ - instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1195,9 +1191,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to - naming conventions. Use `plot_extrema_labels `__ - instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. Utility function to plot high/low contour labels. From 295ac5c0d32249aecf7cf34f4bcb764ba8f76463 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 12 May 2023 14:24:17 -0600 Subject: [PATCH 20/29] deprecated kwargs need to still work for a bit --- src/geocat/viz/util.py | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index d04c37c5..92d1d36d 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1431,8 +1431,14 @@ def set_vector_density(data: xr.DataArray, return ds -def get_skewt_vars(pressure: Quantity, temperature: Quantity, - dewpoint: Quantity, pro: Quantity) -> str: +def get_skewt_vars(pressure: Quantity = None, + temperature: Quantity = None, + dewpoint: Quantity = None, + profile: Quantity = None, + p: Quantity = None, + tc: Quantity = None, + tdc: Quantity = None, + pro: Quantity = None) -> str: """This function processes the dataset values and returns a string element which can be used as a subtitle to replicate the styles of NCL Skew-T Diagrams. @@ -1440,13 +1446,13 @@ def get_skewt_vars(pressure: Quantity, temperature: Quantity, Parameters ---------- pressure : :class:`pint.Quantity` - Pressure level input from dataset + Pressure level input from dataset. Renamed from deprecated kwarg `p`. temperature : :class:`pint.Quantity` - Temperature for parcel from dataset + Temperature for parcel from dataset. Renamed from deprecated kwarg `tc`. dewpoint : :class:`pint.Quantity` - Dew point temperature for parcel from dataset - pro : :class:`pint.Quantity` - Parcel profile temperature converted to degC + Dew point temperature for parcel from dataset. Renamed from deprecated kwarg `tdc`. + profile : :class:`pint.Quantity` + Parcel profile temperature converted to degC. Renamed from deprecated kwarg `pro`. Returns ------- @@ -1470,6 +1476,24 @@ def get_skewt_vars(pressure: Quantity, temperature: Quantity, - `NCL_skewt_2_2 `_ """ + # Support for deprecating kwargs + if p: + pressure = p + warnings.warn( + 'The keyword argument `p` is deprecated. Use `pressure` instead.') + if tc: + temperature = tc + warnings.warn( + 'The keyword argument `tc` is deprecated. Use `temperature` instead.' + ) + if tdc: + dewpoint = tdc + warnings.warn( + 'The keyword argument `tdc` is deprecated. Use `dewpoint` instead.') + if pro: + profile = pro + warnings.warn( + 'The keyword argument `pro` is deprecated. Use `profile` instead.') # CAPE cape = mpcalc.cape_cin(pressure, temperature, dewpoint, pro) From 810a2a68c1ca72514fda8caf11e3e0d053a3e5c5 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Tue, 16 May 2023 08:42:02 -0600 Subject: [PATCH 21/29] pendingdeprecationwarning and relative links --- src/geocat/viz/util.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 92d1d36d..1f71ee20 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -863,7 +863,7 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -909,7 +909,8 @@ def findLocalExtrema(da: xr.DataArray, """ warnings.warn( - "This function is deprecated. Call `find_local_extrema` instead.") + 'This function is deprecated. Call `find_local_extrema` instead.', + PendingDeprecationWarning) return find_local_extrema(da, highVal, lowVal, eType, eps) @@ -1041,7 +1042,7 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1092,7 +1093,8 @@ def plotCLabels(ax: matplotlib.axes.Axes, """ warnings.warn( - "This function is deprecated. Call `plot_contour_labels` instead.") + 'This function is deprecated. Call `plot_contour_labels` instead.', + PendingDeprecationWarning) return plot_contour_labels(ax, contours, transform, proj, clabel_locations, fontsize, whitebbox, horizontal) @@ -1168,7 +1170,7 @@ def plot_contour_labels(ax: matplotlib.axes.Axes, inline=True, fontsize=fontsize, colors='black', - fmt="%.0f") + fmt='%.0f') [cLabels.append(txt) for txt in contours.labelTexts] if horizontal is True: @@ -1191,7 +1193,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. Utility function to plot high/low contour labels. @@ -1244,8 +1246,8 @@ def plotELabels(da: xr.DataArray, """ warnings.warn( - "This function is deprecated. Please use `plot_extrema_labels` instead." - ) + 'This function is deprecated. Please use `plot_extrema_labels` instead.', + PendingDeprecationWarning) return plot_extrema_labels(da, transform, proj, clabel_locations, label, fontsize, whitebbox, horizontal) @@ -1339,7 +1341,7 @@ def plot_extrema_labels(da: xr.DataArray, lab = plt.text(transformed_locations[loc][0], transformed_locations[loc][1], - label + "$_{" + str(p_loc) + "}$", + label + '$_{' + str(p_loc) + '}$', fontsize=fontsize, horizontalalignment='center', verticalalignment='center') @@ -1389,7 +1391,7 @@ def set_vector_density(data: xr.DataArray, import warnings if minDistance <= 0: - raise Exception("minDistance cannot be negative or zero.") + raise Exception('minDistance cannot be negative or zero.') else: lat_every = 1 lon_every = 1 @@ -1480,20 +1482,23 @@ def get_skewt_vars(pressure: Quantity = None, if p: pressure = p warnings.warn( - 'The keyword argument `p` is deprecated. Use `pressure` instead.') + 'The keyword argument `p` is deprecated. Use `pressure` instead.', + PendingDeprecationWarning) if tc: temperature = tc warnings.warn( - 'The keyword argument `tc` is deprecated. Use `temperature` instead.' - ) + 'The keyword argument `tc` is deprecated. Use `temperature` instead.', + PendingDeprecationWarning) if tdc: dewpoint = tdc warnings.warn( - 'The keyword argument `tdc` is deprecated. Use `dewpoint` instead.') + 'The keyword argument `tdc` is deprecated. Use `dewpoint` instead.', + PendingDeprecationWarning) if pro: profile = pro warnings.warn( - 'The keyword argument `pro` is deprecated. Use `profile` instead.') + 'The keyword argument `pro` is deprecated. Use `profile` instead.', + PendingDeprecationWarning) # CAPE cape = mpcalc.cape_cin(pressure, temperature, dewpoint, pro) From ef18ada8e92b29b5b4be6fa17dd4d33445e34ea3 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Tue, 16 May 2023 08:51:50 -0600 Subject: [PATCH 22/29] relative links broken --- src/geocat/viz/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 1f71ee20..d6f15e78 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -863,7 +863,7 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -1042,7 +1042,7 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1193,7 +1193,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. Utility function to plot high/low contour labels. From d92505d265616163ed7ab5d1dfe5b0c152f0ae62 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Tue, 16 May 2023 09:03:00 -0600 Subject: [PATCH 23/29] relative links --- src/geocat/viz/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 45cbbb1a..3096f97e 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -871,7 +871,7 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -1050,7 +1050,7 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1201,7 +1201,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. Utility function to plot high/low contour labels. From 6625e7aba7a6607333df7242c253f10c961c64c3 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Tue, 16 May 2023 09:27:39 -0600 Subject: [PATCH 24/29] relative link --- src/geocat/viz/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 3096f97e..93a358ca 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -871,7 +871,7 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema `__ instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema <../geocat.viz.util.find_local_extrema.html>`__ instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -1050,7 +1050,7 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels <../geocat.viz.util.plot_contour_levels.html>`__ instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1201,7 +1201,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels `__ instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels <../geocat.viz.util.plot_extrema_labels.html>`__ instead. Utility function to plot high/low contour labels. From dacf9c1d5f2e01975b92db1b91679f7e56cd26b3 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Tue, 16 May 2023 14:38:32 -0600 Subject: [PATCH 25/29] try :func: method for internal references --- src/geocat/viz/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 93a358ca..d9039be4 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -871,7 +871,7 @@ def findLocalExtrema(da: xr.DataArray, lowVal: int = 1000, eType: str = 'Low', eps: float = 10) -> list: - r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use `find_local_extrema <../geocat.viz.util.find_local_extrema.html>`__ instead. + r""".. deprecated:: 2023.02.0 The ``findLocalExtrema`` function is deprecated due to naming conventions. Use :func:`find_local_extrema` instead. Utility function to find local low/high field variable coordinates on a contour map. To classify as a local high, the data point must be greater @@ -1050,7 +1050,7 @@ def plotCLabels(ax: matplotlib.axes.Axes, fontsize: int = 12, whitebbox: bool = False, horizontal: bool = False) -> list: - r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use `plot_contour_levels <../geocat.viz.util.plot_contour_levels.html>`__ instead. + r""".. deprecated:: 2023.02.0 The ``plotCLabels`` function is deprecated due to naming conventions. Use :func:`plot_contour_levels` instead. Utility function to plot contour labels by passing in a coordinate to the clabel function. @@ -1201,7 +1201,7 @@ def plotELabels(da: xr.DataArray, fontsize: int = 22, whitebbox: bool = False, horizontal: bool = True) -> list: - r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use `plot_extrema_labels <../geocat.viz.util.plot_extrema_labels.html>`__ instead. + r""".. deprecated:: 2023.02.0 The ``plotELabels`` function is deprecated due to naming conventions. Use :func:`plot_extrema_labels` instead. Utility function to plot high/low contour labels. From b0065676f7bdfd500f8394e3f9b17b177027ca88 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Tue, 16 May 2023 15:53:51 -0600 Subject: [PATCH 26/29] pro --- src/geocat/viz/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index d9039be4..2c101e68 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1509,7 +1509,7 @@ def get_skewt_vars(pressure: Quantity = None, PendingDeprecationWarning) # CAPE - cape = mpcalc.cape_cin(pressure, temperature, dewpoint, pro) + cape = mpcalc.cape_cin(pressure, temperature, dewpoint, profile) cape = cape[0].magnitude # Precipitable Water From ca5340be82942398e29a22933452cd6643808153 Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Thu, 18 May 2023 16:11:16 -0600 Subject: [PATCH 27/29] add deprecated kwargs to docstring --- src/geocat/viz/util.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 2c101e68..bd349d1d 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1463,6 +1463,37 @@ def get_skewt_vars(pressure: Quantity = None, Dew point temperature for parcel from dataset. Renamed from deprecated kwarg `tdc`. profile : :class:`pint.Quantity` Parcel profile temperature converted to degC. Renamed from deprecated kwarg `pro`. + p : :class:`pint.Quantity` + Pressure level input from dataset. + + .. deprecated:: 2023.06.0 + In an effort to refactor the codebase to follow naming conventions, + keyword arguments have been renamed to more meaningful values. + ``p`` parameter has been deprecated in favor of ``pressure`. + + tc : :class:`pint.Quantity` + Temperature for parcel from dataset. + + .. deprecated:: 2023.06.0 + In an effort to refactor the codebase to follow naming conventions, + keyword arguments have been renamed to more meaningful values. + ``tc`` parameter has been deprecated in favor of ``temperature`. + + tdc : :class:`pint.Quantity` + Dew point temperature for parcel from dataset. + + .. deprecated:: 2023.06.0 + In an effort to refactor the codebase to follow naming conventions, + keyword arguments have been renamed to more meaningful values. + ``tdc`` parameter has been deprecated in favor of ``dewpoint`. + + pro : :class:`pint.Quantity` + Parcel profile temperature converted to degC. + + .. deprecated:: 2023.06.0 + In an effort to refactor the codebase to follow naming conventions, + keyword arguments have been renamed to more meaningful values. + ``pro`` parameter has been deprecated in favor of ``profile`. Returns ------- From da6dc99443ba7259f02e40f7f38a4a03bac4d80d Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 19 May 2023 08:50:36 -0600 Subject: [PATCH 28/29] space off --- src/geocat/viz/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index bd349d1d..14fec020 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1511,7 +1511,7 @@ def get_skewt_vars(pressure: Quantity = None, `skewT_PlotData `_, `skewt_BackGround `_ - Examples + Examples -------- All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the `website `_. From b04cabff355f529cc2d59e710156a5cd23b5710c Mon Sep 17 00:00:00 2001 From: Julia Kent <46687291+jukent@users.noreply.github.com> Date: Fri, 19 May 2023 15:23:14 -0600 Subject: [PATCH 29/29] `` --- .../util/add_height_from_pressure_axis.ipynb | 100 ++++++++++++++++++ src/geocat/viz/util.py | 6 +- 2 files changed, 103 insertions(+), 3 deletions(-) create mode 100644 gallery/util/add_height_from_pressure_axis.ipynb diff --git a/gallery/util/add_height_from_pressure_axis.ipynb b/gallery/util/add_height_from_pressure_axis.ipynb new file mode 100644 index 00000000..d37b2479 --- /dev/null +++ b/gallery/util/add_height_from_pressure_axis.ipynb @@ -0,0 +1,100 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "# Import Packages:\n", + "\n", + "import numpy as np\n", + "import xarray as xr\n", + "import matplotlib.pyplot as plt\n", + "from matplotlib.ticker import ScalarFormatter\n", + "import cmaps\n", + "import metpy.calc as mpcalc\n", + "from metpy.units import units\n", + "\n", + "import scipy\n", + "\n", + "#import geocat.datafiles as gdf\n", + "import geocat.viz as gv" + ] + }, + { + "cell_type": "raw", + "metadata": {}, + "source": [ + "# Open a netCDF data file using xarray default engine and load the data into xarrays\n", + "ds = xr.open_dataset(gdf.get(\"netcdf_files/mxclim.nc\"))\n", + "\n", + "# Extract variables\n", + "U = ds.U[0, :, :]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAscAAAKTCAYAAAD16aXPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjUuMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8/fFQqAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAm0ElEQVR4nO3de3CV9Z348c+BYEAEagQxkoBAFQ3eA1FxLegqjF21yjLq2kHb6mxxqYWl9YqrLeOOl13RaqNr6w1n1MUbbsfBC2UNYu0satGq0alyTVREYOQSQQSe3x/9kl+5Kbmf4Os1k5me5zznfD/0O9i3T895ksuyLAsAACA6tPUAAACQL8QxAAAk4hgAABJxDAAAiTgGAIBEHAMAQCKOAQAgKWjrARpq06ZNMX/+/Ojdu3d06KDtAQDyzZYtW+KTTz6JY445JgoK2ldutq9pI2L+/PlRUVHR1mMAAPA15s2bF0OHDm3rMRqk3cVx7969I+Kv/2UXFxe38TQAAGzv448/joqKivpua0/aXRxv/ShFcXFxlJSUtPE0AADsSnv8CGz7mxgAAFqIOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACB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QcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACQFbT0AAAB8neXLl8eSJUvi008/jfXr10fPnj2jV69eMWjQoOjYsWOzrSOOAQDIS7NmzYrp06fHSy+9FAsWLNjpOXvvvXccf/zxMWrUqBg7dmz07t27SWvmsizLmvQOray2tjZKS0ujpqYmSkpK2nocAAC205Re27BhQ9x5551x9913x5IlS2Jrqnbp0iX233//KCoqii5dusSqVati1apVsXz58oiIyOVyUVBQEGeccUZcc801UV5e3qjZXTkGACAv3H///XH99dfHhx9+GIWFhXHWWWfFGWecERUVFTF48ODo0GHHr8utWrUq5s2bFy+//HI89thjMWPGjHj66afj3HPPjZtuuin69evXoBlcOQYAoFk1ttc6dOgQAwYMiCuuuCLOP//86N69e4PXfv311+OOO+6IRx99NK699tq47rrrGvR6V44BAMgL06ZNiwsuuKBJX7ArLy+PadOmxS9+8Yuora1t8OvbTRxXVlZGZWVlbNy4sa1HAQCgBYwdO7bZ3qt///7Rv3//Br+u3dznePz48VFdXR1VVVVtPQoAAHuodhPHAADQ0trNxyoAAPjmev755+O5556LhQsXxrp162JX95TI5XIxe/bsRq8jjgEAyFtr1qyJs88+O+bMmbPLIP5buVyuSeuJYwAA8taVV14ZVVVVUVRUFP/8z/8cxxxzTPTq1avJEbwr4hgAgLz11FNPRadOnWLOnDkxePDgFl/PF/IAAMhbdXV1MWjQoFYJ4whxDABAHjv00ENj/fr1rbaeOAYAIG+NHz8+FixY0Gq/60IcAwCQt374wx/GZZddFqNHj44777wz1q1b16Lr+UIeAAB57ZZbbomampqYOHFiTJw4MXr16hV77733Ts/N5XKxYMGCRq8ljgEAyFuffPJJnHrqqVFdXV1/n+Ply5fv8nz3OQYAYI915ZVXxjvvvBPf/va34/LLL4+jjz7afY4BAPhmeu6556Jz585RVVUVBx54YIuv5wt5AADkrbq6ujj00ENbJYwjxDEAAHnsiCOOiJUrV7baeuIYAIC8dfnll0dNTU089thjrbKeOAYAIG+dc845cccdd8Qll1wSP/vZz+Kdd96JDRs2tNh6vpAHAEDe6tixY/1/vv322+P222//yvNzuVxs2rSp0euJYwAA8tbWexu31PnbE8cAAOStLVu2tOp6PnMMAACJOAYAIG+9+eabDTr/rrvuatJ64hgAgLw1atSoeP/993fr3Ntuuy0uu+yyJq0njgEAyFvLly+P0047LWpqar7yvJtuuil+9rOfRdeuXZu0njgGACBv3XLLLbF06dI49dRTY/ny5Ts95xe/+EVcc8010a1bt3j22WebtJ44BgAgb/385z+Pa6+9Nt5///0YOXJkfPbZZ9s8f/XVV8eUKVOiR48eMWvWrDjxxBObtJ44BgAgr02ZMiUuu+yy+POf/xynn3561NXVRUTEpEmT4uabb46ioqKYPXt2VFRUNHkt9zkGACDv/epXv4o1a9bEtGnT4swzz4xBgwbFPffcE7169Yrf//73ccQRRzTLOuIYAIB24b777ou1a9fGU089FXPmzIkDDjggZs+eHYcddlizrSGOAQDIC0uXLv3ac2688cZYvHhxLFiwIB566KHo2rXrDq/r27dvo2cQxwAA5IWDDjoocrncbp8/atSoHY7lcrnYtGlTo2cQxwAA5IW+ffs2KI5bgjgGACAvLF68uK1HcCs3AADYShwDAEAijgEAyAu1tbXN+n4fffRRg18jjgEAyAsDBw6MSy+9NJYsWdLo99iyZUs88sgjMXjw4Lj33nsb/HpxDABAXvje974X99xzTwwcODD+/u//Pu69997duvr75ZdfxiuvvBITJkyIPn36xNixY2P16tVx0kknNXgGd6sAACAvPPbYY/Hqq6/GVVddFS+++GJUVVVFRERxcXGUl5dHcXFxFBUVRWFhYXz22WexatWqePfdd+Ott96KjRs3RpZlse+++8YNN9wQEydOjC5dujR4BnEMAEDeGDp0aMyePTvee++9uOeee+Lxxx+Pjz76qP4K8tb7IGdZVv+aTp06xfDhw+Piiy+OMWPGRGFhYaPXz2V/+87tQG1tbZSWlkZNTU2UlJS09TgAAGynuXttwYIF8cor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AAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBAIo4BACARxwAAkIhjAABIxDEAACTiGAAAEnEMAACJOAYAgEQcAwBA0iZx/Mwzz8SgQYPi4IMPjnvvvbctRgAAgB0UtPaCmzZtikmTJsWLL74Y3bt3j2OPPTZGjx4dRUVFrT0KAABso9WvHM+bNy8GDx4cffr0iW7dusV3v/vdeP7551t7DAAA2EGD4/ill16KM888Mw488MDI5XLx9NNP73DOXXfdF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WXtNUfgQZo6H4/8MADWUFBQXbXXXdlCxYsyF5++eVsyJAhWUVFRVv9EWiAtWvXZvPnz8/mz5+fRUQ2derUbP78+fW37mvPvZZ3cZxlWVZZWZn169cv22uvvbJjjz02mzNnTv1zF110UTZ8+PBtzq+qqsqOOeaYbK+99soOOuig7O67727liWmKhuz38OHDs4jY4eeiiy5q/cFplIb+/f5b4rj9aeh+v/vuu9mpp56adenSJSspKckmTZqUff755608NY3V0P2+4447srKysqxLly5ZcXFx9v3vfz+rra1t5alpjBdffPEr//e4PfdaLsv8fxcAABCRZ585BgCAtiSOAQAgEccAAJCIYwAASMQxAAAk4hgAABJxDAAAiTgGAIBEHAMAQCKOAQAgEccAAJD8P07w49W+NtKxAAAAAElFTkSuQmCC", + "text/plain": [ + "
" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "# Generate figure (set its size (width, height) in inches) and axes\n", + "plt.figure(figsize=(8, 8))\n", + "ax = plt.axes()\n", + "\n", + "# Set y-axis to have log-scale\n", + "plt.yscale('log')\n", + "\n", + "# Specify which contours should be drawn\n", + "levels = np.linspace(-55, 55, 23)\n", + "\n", + "# Plot contour lines\n", + "lines = U.plot.contour(ax=ax,\n", + " levels=levels,\n", + " colors='black',\n", + " linewidths=0.5,\n", + " linestyles='solid',\n", + " add_labels=False)\n", + "\n", + "# Create second y-axis to show geo-potential height.\n", + "axRHS = gv.add_height_from_pressure_axis(ax, heights=[4, 8])\n", + "\n", + "plt.show();" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "geocat_viz_build", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.0" + }, + "orig_nbformat": 4 + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/src/geocat/viz/util.py b/src/geocat/viz/util.py index 14fec020..10a98c12 100644 --- a/src/geocat/viz/util.py +++ b/src/geocat/viz/util.py @@ -1477,7 +1477,7 @@ def get_skewt_vars(pressure: Quantity = None, .. deprecated:: 2023.06.0 In an effort to refactor the codebase to follow naming conventions, keyword arguments have been renamed to more meaningful values. - ``tc`` parameter has been deprecated in favor of ``temperature`. + ``tc`` parameter has been deprecated in favor of ``temperature``. tdc : :class:`pint.Quantity` Dew point temperature for parcel from dataset. @@ -1485,7 +1485,7 @@ def get_skewt_vars(pressure: Quantity = None, .. deprecated:: 2023.06.0 In an effort to refactor the codebase to follow naming conventions, keyword arguments have been renamed to more meaningful values. - ``tdc`` parameter has been deprecated in favor of ``dewpoint`. + ``tdc`` parameter has been deprecated in favor of ``dewpoint``. pro : :class:`pint.Quantity` Parcel profile temperature converted to degC. @@ -1493,7 +1493,7 @@ def get_skewt_vars(pressure: Quantity = None, .. deprecated:: 2023.06.0 In an effort to refactor the codebase to follow naming conventions, keyword arguments have been renamed to more meaningful values. - ``pro`` parameter has been deprecated in favor of ``profile`. + ``pro`` parameter has been deprecated in favor of ``profile``. Returns -------