scripts.plotting.cam_taylor_diagram =================================== .. py:module:: scripts.plotting.cam_taylor_diagram .. autoapi-nested-parse:: Module: cam_taylor_diagram Provides a Taylor diagram following the AMWG package. Uses spatial information only. This module, for better or worse, provides both the computation and plotting functionality. It depends on an ADF instance to obtain the `climo` files. It is designed to have one "reference" case (could be observations) and arbitrary test cases. When multiple test cases are provided, they are plotted with different colors. Functions --------- .. autoapisummary:: scripts.plotting.cam_taylor_diagram.my_formatwarning scripts.plotting.cam_taylor_diagram.cam_taylor_diagram scripts.plotting.cam_taylor_diagram.vertical_average scripts.plotting.cam_taylor_diagram.find_landmask scripts.plotting.cam_taylor_diagram.get_prect scripts.plotting.cam_taylor_diagram.get_tropical_land_precip scripts.plotting.cam_taylor_diagram.get_tropical_ocean_precip scripts.plotting.cam_taylor_diagram.get_surface_pressure scripts.plotting.cam_taylor_diagram.get_var_at_plev scripts.plotting.cam_taylor_diagram.get_u_at_plev scripts.plotting.cam_taylor_diagram.get_vertical_average scripts.plotting.cam_taylor_diagram.get_virh scripts.plotting.cam_taylor_diagram.get_vit scripts.plotting.cam_taylor_diagram.get_landt2m scripts.plotting.cam_taylor_diagram.get_eqpactaux scripts.plotting.cam_taylor_diagram.get_derive_func scripts.plotting.cam_taylor_diagram._retrieve scripts.plotting.cam_taylor_diagram.weighted_correlation scripts.plotting.cam_taylor_diagram.weighted_std scripts.plotting.cam_taylor_diagram.taylor_stats_single scripts.plotting.cam_taylor_diagram.taylor_plot_setup scripts.plotting.cam_taylor_diagram.plot_taylor_data scripts.plotting.cam_taylor_diagram.taylor_plot_finalize Module Contents --------------- .. py:function:: my_formatwarning(msg, *args, **kwargs) .. py:function:: cam_taylor_diagram(adfobj) Make a Taylor Diagram, eh? .. py:function:: vertical_average(fld, ps, acoef, bcoef) Calculate weighted vertical average using trapezoidal rule. Uses full column. .. py:function:: find_landmask(adf, casename, location) .. py:function:: get_prect(casename, location, **kwargs) .. py:function:: get_tropical_land_precip(adf, casename, location, **kwargs) .. py:function:: get_tropical_ocean_precip(adf, casename, location, **kwargs) .. py:function:: get_surface_pressure(dset, casename, location) .. py:function:: get_var_at_plev(adf, casename, location, variable, plev) Get `variable` from the data and then interpolate it to isobaric level `plev` (units of hPa). .. py:function:: get_u_at_plev(adf, casename, location) .. py:function:: get_vertical_average(adf, casename, location, varname) Collect data from case and use `vertical_average` to get result. .. py:function:: get_virh(adf, casename, location, **kwargs) Calculate vertically averaged relative humidity. .. py:function:: get_vit(adf, casename, location, **kwargs) Calculate vertically averaged temperature. .. py:function:: get_landt2m(adf, casename, location) Gets TREFHT (T_2m) and removes non-land points. .. py:function:: get_eqpactaux(adf, casename, location) Gets zonal surface wind stress 5S to 5N. .. py:function:: get_derive_func(fld) .. py:function:: _retrieve(adfobj, variable, casename, location, return_dataset=False) Custom function that retrieves a variable. Returns the variable as a DataArray. kwarg: return_dataset -> if true, return the dataset object, otherwise return the DataArray with `variable` This option allows get_u_at_plev to use _retrieve. .. py:function:: weighted_correlation(x, y, weights) .. py:function:: weighted_std(x, weights) Weighted standard deviation. x -> xr.DataArray weights -> array-like of weights, probably xr.DataArray If weights is not the same shape as x, will use `broadcast_like` to create weights array. Returns the weighted standard deviation of the full x array. .. py:function:: taylor_stats_single(casedata, refdata, w=True) This replicates the basic functionality of 'taylor_stats' from NCL. input: casedata : input data, DataArray refdata : reference case data, DataArray w : if true use cos(latitude) as spatial weight, if false assume uniform weight :returns: pattern_correlation, ratio of standard deviation (case/ref), bias .. py:function:: taylor_plot_setup(title, baseline) Constructs Figure and Axes objects for basic Taylor Diagram. .. py:function:: plot_taylor_data(wks, df, **kwargs) Apply data on top of the Taylor Diagram Axes. wks -> Axes object, probably from taylor_plot_setup df -> DataFrame holding the Taylor stats. kwargs -> optional arguments look for 'use_bias' look for 'case_color' .. py:function:: taylor_plot_finalize(wks, test_nicknames, casecolors, syear_cases, eyear_cases, needs_bias_labels=True) Apply final formatting to a Taylor diagram. wks -> Axes object that has passed through taylor_plot_setup and plot_taylor_data casenames -> list of case names for the legend casecolors -> list of colors for the cases needs_bias_labels -> Bool, if T make the legend for the bias-sized markers.