    Make a given node wait for the trigger node to complete.
    @param node: The node that has to wait.
    @param trigger: The trigger node.
    @type node: ecflow.[family/task]
    @type trigger: ecflow.[family/task]
    @return: None


Make new family for given node.


    Given an ecflow node, walk the tree in downward direction
    and collect all families.

    @param node: The node to start from.
    @type node: ecflow.Node
    @return: All collected families
    @rtype: list


Build the ecflow suite.


Replace code with band name.


Replace band code with color.


Replace radio code with color.


Replace xray code with color.


Replace band alias with name.


Replace band code with group.


Replace band code with short alias.


Replace band code with wavelength.


Replace band with meta.


Replace print function in Python 2.x.


Generate lines for output.


Add colors to text.


Print text without modification.


Return message string.


Print a message from a dictionary of strings.


Prompt the user for input and return a value based on response.


Print status message showing state of fitting process.


Translate text to another language.


Replace ANSI codes and return the list of codes.


Pretty print the module dependency trees for each root.


Print a character based on range from 0 - 1.


Return if current terminal supports color or not.


Add catalog name(s) to list of catalogs that will be excluded.


Fetch a list of events from the open catalogs.


Return data from specified path.


Check if input is a valid date.


Check if input is an integer.


Check if input is a number.


Check if input is a coordinate.


Check if input is some sort of data.


Convert number into string with specified significant digits.


Round number with specified significant digits.


Convert item to a `list` of items if it isn't already a `list`.


Produce entabbed string for JSON output.

    This is necessary because Python 2 does not allow tabs to be used in its
    JSON dump(s) functions.


Write `entabbed_json_dumps` output to file handle.


WAIC from Gelmanp.

    http://www.stat.columbia.edu/~gelman/research/published/waic_understand3


Return coeffiecent to convert GHz to Hz.


Return a hash bytestring.

    Necessary to have consistent behavior between Python 2 & 3.


Determine if we are the master process.


Text to speech. For fun.


Rebin an array to a new shape.


Arbitrary resampling of source array to new dimension sizes.

    Currently only supports maintaining the same number of dimensions.
    To use 1-D arrays, first promote them to shape (x,1).

    Uses the same parameters and creates the same co-ordinate lookup points
    as IDL''s congrid routine, which apparently originally came from a VAX/VMS
    routine of the same name.

    method:
    neighbour - closest value from original data
    nearest and linear - uses n x 1-D interpolations using
                         scipy.interpolate.interp1d
    (see Numerical Recipes for validity of use of n 1-D interpolations)
    spline - uses ndimage.map_coordinates

    center:
    True - interpolation points are at the centers of the bins
    False - points are at the front edge of the bin

    minusone:
    For example- inarray.shape = (i,j) & new dimensions = (x,y)
    False - inarray is resampled by factors of (i/x) * (j/y)
    True - inarray is resampled by(i-1)/(x-1) * (j-1)/(y-1)
    This prevents extrapolation one element beyond bounds of input array.


Recursively convert list of numpy arrays to lists.


Match multiple strings to replace in sequence.


Clean a transient's name.


Slugify string to make it a valid filename.

    Convert to ASCII if 'allow_unicode' is False. Convert spaces to hyphens.
    Remove characters that aren't alphanumerics, underscores, or hyphens.
    Also strip leading and trailing whitespace.


Context for temporary file.

    Will find a free temporary filename upon entering
    and will try to delete the file on leaving, even in case of an exception.

    Parameters
    ----------
    suffix : string
        optional file suffix
    dir : string
        optional directory to save temporary file in


Open temporary file object that atomically moves upon exiting.

    Allows reading and writing to and from the same filename.

    The file will not be moved to destination in case of an exception.

    Parameters
    ----------
    filepath : string
        the file path to be opened
    fsync : bool
        whether to force write the file to disk
    *args : mixed
        Any valid arguments for :code:`open`
    **kwargs : mixed
        Any valid keyword arguments for :code:`open`


Draw a walker from the global model variable.


Fit a list of events with a list of models.


Fit the data for a given event.

        Fitting performed using a combination of emcee and fracking.


Generate simulated data based on priors.


Estimate the integrated autocorrelation time of a time series.

        This estimate uses the iterative procedure described on page 16 of
        `Sokal's notes <http://www.stat.unc.edu/faculty/cji/Sokal.pdf>`_ to
        determine a reasonable window size.

        Args:
            x: The time series. If multidimensional, set the time axis using
                the ``axis`` keyword argument and the function will be
                computed for every other axis.
            low (Optional[int]): The minimum window size to test. (default:
                ``10``)
            high (Optional[int]): The maximum window size to test. (default:
                ``x.shape[axis] / (2*c)``)
            step (Optional[int]): The step size for the window search.
                (default: ``1``)
            c (Optional[float]): The minimum number of autocorrelation times
                needed to trust the estimate. (default: ``10``)
            full_output (Optional[bool]): Return the final window size as well
                as the autocorrelation time. (default: ``False``)
            axis (Optional[int]): The time axis of ``x``. Assumed to be the
                first axis if not specified.
            fast (Optional[bool]): If ``True``, only use the first ``2^n`` (for
                the largest power) entries for efficiency. (default: False)

        Returns:
            float or array: An estimate of the integrated autocorrelation time
                of the time series ``x`` computed along the axis ``axis``.
            Optional[int]: The final window size that was used. Only returned
                if ``full_output`` is ``True``.

        Raises
            AutocorrError: If the autocorrelation time can't be reliably
                estimated from the chain. This normally means that the chain
                is too short.


Advance the chains ``iterations`` steps as a generator.

        :param p0:
            The initial positions of the walkers.  Shape should be
            ``(ntemps, nwalkers, dim)``.
        :param lnprob0: (optional)
            The initial posterior values for the ensembles.  Shape
            ``(ntemps, nwalkers)``.
        :param lnlike0: (optional)
            The initial likelihood values for the ensembles.  Shape
            ``(ntemps, nwalkers)``.
        :param iterations: (optional)
            The number of iterations to preform.
        :param thin: (optional)
            The number of iterations to perform between saving the
            state to the internal chain.
        :param storechain: (optional)
            If ``True`` store the iterations in the ``chain``
            property.
        At each iteration, this generator yields
        * ``p``, the current position of the walkers.
        * ``lnprob`` the current posterior values for the walkers.
        * ``lnlike`` the current likelihood values for the walkers.


Load the data for the specified event.


Create free parameters that depend on loaded data.


Estimate the number of measurements.


Generate `_free_parameters` and `_num_free_parameters`.


Exchange requests between modules.


Perform fracking upon a single walker.

        Uses a randomly-selected global or local minimization method.


Construct call trees for each root.


Draw parameters into unit interval using parameter inverse CDFs.


Draw a walker randomly.

        Draw a walker randomly from the full range of all parameters, reject
        walkers that return invalid scores.


Return the maximum depth a given task is found in a tree.


Score for `BayesianOptimization`.


Return score for fracking.


Pluralize and cache model-related keys.


Run module stack.

        Run a stack of modules as defined in the model definition file. Only
        run functions that match the specified root.


Generate a list of events and/or convert events to JSON format.


Assign columns based on header.


Append output from the ensembler to the model description.


Prepare output for writing to disk and uploading.


Use ensemble sampling to determine posteriors.


Calculate PSRF for a chain.


Get the kernel matrix associated with best current scoring model.


Append output from the nester to the model description.


Use nested sampling to determine posteriors.


        Clear the ``chain``, ``lnprobability``, ``lnlikelihood``,
        ``acceptance_fraction``, ``tswap_acceptance_fraction`` stored
        properties.


        Advance the chains ``iterations`` steps as a generator.

        :param p0:
            The initial positions of the walkers.  Shape should be
            ``(ntemps, nwalkers, dim)``.

        :param lnprob0: (optional)
            The initial posterior values for the ensembles.  Shape
            ``(ntemps, nwalkers)``.

        :param lnlike0: (optional)
            The initial likelihood values for the ensembles.  Shape
            ``(ntemps, nwalkers)``.

        :param iterations: (optional)
            The number of iterations to preform.

        :param thin: (optional)
            The number of iterations to perform between saving the
            state to the internal chain.

        :param storechain: (optional)
            If ``True`` store the iterations in the ``chain``
            property.

        At each iteration, this generator yields

        * ``p``, the current position of the walkers.

        * ``lnprob`` the current posterior values for the walkers.

        * ``lnlike`` the current likelihood values for the walkers.


Manipulate output keys conditionally.


Substitute user-defined replacement key names for local names.


Prepare keys conditionally.


Set `dense_*` and `*_since_exp` times/luminosities keys.


Construct kernel distance arrays.


Construct arrays of observations based on data keys.


Send requests to other modules.


X-ray extinction in the ISM from Morisson & McCammon 1983.


    Calculate the corresponding blackbody radiance for a set
    of wavelengths given a temperature and radiance and a
    suppresion factor

    Parameters
    ---------------
    lam: Reference wavelengths in Angstroms
    T:   Temperature in Kelvin
    R2:   Radius in cm, squared

    Output
    ---------------
    Spectral radiance in units of erg/s/Angstrom

    (calculation and constants checked by Sebastian Gomez)


Receive requests from other ``Module`` objects.


Add SED from module to existing ``seds`` key.

        Parameters
        ----------
        new_seds : array
            The new SEDs to add to the existing SEDs.

        Returns
        -------
        new_seds : array
            The result of summing the new and existing SEDs.


Send a request.


Load band files.


Find the index corresponding to the provided band information.


Return average wavelengths for specified band indices.


Return the list of unique band names.


Return the list of instruments.


Return the list of telescopes.


Convert fluxes into AB magnitude.


Process module. Add constraints below.


Fix value of parameter.


Return the value of the parameter in parameter's units.


Return fraction given a parameter's value.


Process module.

        Initialize a parameter based upon either a fixed value or a
        distribution, if one is defined.


Evaluate natural log of probability density function.


Evaluate inverse cumulative density function.


Evaluate natural log of probability density function.

        PDF from Kroupa (2001b)


Cumulative density function from Kroupa 2001b.

        0.01 <= mass, k is normalization


Evaluate inverse cumulative density function from Kroupa 2001b.

        output mass scaled to 0-1 interval


Calculate the likelihood, returning ln(likelihood).


 Read CSV input file with stellar and planetary parameters

    Args:
        comp_option_mass:       Provided observables for mass (0 - relative mass, 1 - planet mass)
        comp_option_radius:     Provided observables for radius (0 - transit depth, 1 - radius ratio, 2 - planet radius)
        csv_file:               Name of input CSV file
        comment:                Comment string to be added to name
        date_string:
        verbose:                Verbose setting (print read input data for each system)


 Load trained DNN

    Args:
        option:       Model version that should be loaded (X_mY)


 Open parameter and attribute files and set scaler to right values

    Args:
        params_filename:        Filename of parameter file
        attributes_filename:    Filename of attributes file


 Load scalers used for training DNN

    Args:
        option:       Model version that should be loaded (X_mY)


 Define stellar parameters from read-in CSV file

    Output:     2 1D arrays with parameters and sigmas (0 - M_star, 1 - R_star, 2 - Teff_star, 3 - SiFe_star, 4 - MgFe_star, 5 - age_star)

    Args:
        obs:    read-in CSV file (pandas object)
        i:      line number of first planet in current system


 Calculate relative mass of planet (to star), proportional to RV semi-amplitude

    Args:
        Mstar:          Stellar mass [Mjup]
        Mplanet:        Planet mass [Mearth]


 Define planetary parameters from read-in CSV file

    Args:
        obs:                    read-in CSV file (pandas object)
        i:                      line number of current planet
        comp_option_mass:       provided observables for mass (0 - relative mass, 1 - planet mass)
        comp_option_radius:     provided observables for radius (0 - transit depth, 1 - radius ratio, 2 - planet radius)


 Define priors for sampling

    Args:
        params_star:            Stellar parameters (0 - M_star, 1 - R_star, 2 - Teff_star, 3 - SiFe_star, 4 - MgFe_star, 5 - age_star)
        sigmas_star:            Sigmas of stellar parameters
        water_mixing_option:
        with_gas:               Model with or without gas layer (True/False)
        with_water:             Model with or without water layer (True/False)


 Generate random array with stars

    Output:     3d array with axes:
                    axis 0: empty (for consistency)
                    axis 1: accepted generated stars
                    axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star)

    Args:
        npts:                       Number of stars to be generated initially
        params_star:                Stellar parameters (0 - M_star, 1 - R_star, 2 - Teff_star, 3 - SiFe_star, 4 - MgFe_star, 5 - age_star)
        sigmas_star:                Sigmas of stellar parameters
        debug_star_generation:      Debug option (print number of stars and array size)


 Helper function to only keep the rows (axis=1) of a 3d array where a condition holds true

        Args:
            array:  Array that operation should be perfomed on
            index:  Boolean array with same length as array, tells us where in array condition holds true


 Generate array with planets (as many as there are stars in stars) and sample planet masses

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (only mass after this function)

    Args:
        params_target:              Planetary parameters (for each planet: 0 - mass, 1 - radius, 2 - period)
        sigmas_target:              Sigmas of planetary parameters
        stars:                      3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:                   Number of planets in the system
        comp_option_mass:           provided observables for mass (0 - relative mass, 1 - planet mass)


 Sample simplex coordinates for composition for planets in planets array

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y)

    Args:
        planets:        Previously generated 3d array with planet masses
        stars:          3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:       Number of planets in the system


convert from cartesian coordinates (X, Y) to ternary coordinates on simplex (x, y, z)


convert back from ternary coordinates on simplex (x, y, z) to cartesian coordinates (X, Y)


 compute layer mass fractions for the solid part of the planet

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core)

    Args:
        planets:        Previously generated 3d array with planet properties
        stars:          3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:       Number of planets in the system


 sample layer mass fraction for H/He layer

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core, w_gas)

    Args:
        planets:                        Previously generated 3d array with planet properties
        nplanets:                       Number of planets in the system
        use_log_prior_for_gas_mass:     Prior option for gas mass (log-uniform or uniform)


 calculate luminosity of low mass planets from stellar age using fit from Mordasini 2020

    Output:     estimated planet luminosity

    Args:
        M_core:             Core mass in Earth masses
        M_envelope:         Envelope mass in Earth masses
        age_star:           Sampled age of the star


 sample planet luminosity

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core, w_gas, luminosity)

    Args:
        planets:                        Previously generated 3d array with planet properties
        stars:                          3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:                       Number of planets in the system
        luminosity_option:              Prior option for luminosity (log-uniform or uniform)


 sample period of the planet

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core, w_gas, luminosity, period)

    Args:
        planets:            Previously generated 3d array with planet properties
        params_target:      Planetary parameters (for each planet: 0 - mass, 1 - radius, 2 - period)
        sigmas_target:      Sigmas of planetary parameters
        stars:              3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:           Number of planets in the system


 sample Si/Mg/Fe ratios of the planet

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core, w_gas, luminosity, period, SiFe_planet, MgFe_planet)

    Args:
        planets:                Previously generated 3d array with planet properties
        stars:                  3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:               Number of planets in the system
        SiMgFe_ratio_option:


compute Si/Mg/Fe bulk ratios from sampled layer mass and molar fractions


 compute mantle composition

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core, w_gas, luminosity, period, shift_SiFe_planet, shift_MgFe_planet, SiFe_planet, MgFe_planet, x_Si_mantle, x_Mg_mantle, x_Fe_mantle)

    Args:
        planets:        Previously generated 3d array with planet properties
        stars:          3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        nplanets:       Number of planets in the system


 compute semimajor axis from mass of star and period of the planet

    Output:
        a [m]

    Args:
        M_star [Mjup]
        P_planet [day]


 compute equilibrium temperature of the planet

    Output:
        Teq [K]

    Args:
        Teff_star [K]
        R_star [Rsun]
        M_star [Mjup]
        P_planet [day]


 compute Hill radius of the planet

    Output:
        R_H [Rearth]

    Args:
        M_star [Mjup]
        m_planet [Mearth]
        P_planet [day]


 compute Bondi radius of the planet (assumes ideal gas law)

    Output:
        R_B [Rearth]

    Args:
        m_planet [Mearth]
        Teq [K]
        Z_atmo [weight mass fraction]


 compute total radius of structure using DNN and compare to observations

    Output:     3d array with axes:
                    axis 0 - different planets in the system (total: nplanets_system)
                    axis 1 - accepted generated planets
                    axis 2 - planetary properties (mass, X, Y, ws_core, ws_mantle, ws_water, x_Fe_core, x_S_core, w_gas, luminosity, period, SiFe_planet, MgFe_planet, x_Si_mantle, x_Mg_mantle, x_Fe_mantle)

    Args:
        planets:                Previously generated 3d array with planet properties
        stars:                  3d array (axis 0: empty, axis 1: accepted generated stars, axis 2: stellar properties (M_star, R_star, Teff_star, SiFe_star, MgFe_star))
        params_target:          Planetary parameters (for each planet: 0 - mass, 1 - radius, 2 - period)
        sigmas_target:          Sigmas of planetary parameters
        nplanets:               Number of planets in the system
        dnn_prediction:
        scaler_x:
        scaler_y:
        comp_option_radius:     provided observables for radius (0 - transit depth, 1 - radius ratio, 2 - planet radius)
        water_mixing_option:


Convert a Batch to a dictionary of job information - {(path, frame): Batch}.


    Convert a Batch to a DataFrame of product information.
    [filename, job_id, sceneName, pathNumber, frameNumber, startTime, stopTime]


Submit RTC jobs for granules in search results (geojson or GeoDataFrame).


Download files for a batch and sort them into corresponding path_frame folders in dst directory.


Copy downloaded files to project directory and update rtc_jobs.json and rtc_products.csv.


Group granules by frames.


Search Sentinel-1 granules that intersect with AOI and were acquired between the start and end dates.


    Analyze the strata image.

    Args:
        strata_path (str): The path to the strata image in Google Earth Engine.

    Returns:
        list: A list containing:
            - strata (ee.Image): The strata image.
            - strata_df (pd.DataFrame): The category statistics.
            - misc (dict): A Python dictionary containing miscellaneous
              information such as minimum and maximum, category values,
              bounding box (bbox), and scale.


    Args:
        strata_df (pd.DataFrame): DataFrame with category counts.
        absenceCats (list): List of absence category IDs.
        presenceCats (list): List of presence category IDs.

    Returns:
        pd.DataFrame: Consolidated DataFrame with binary class counts, including
        the columns:
            - 'Cat': Binary class labels (0 for absence, 1 for presence).
            - 'pixel_ct': Total pixel count for each binary class.
            - 'pct_area': Relative shares of binary classes based on total area
              of interest (in percentage).


    Adjust strata DataFrame for binary classification.

    Args:
        strata_df (pd.DataFrame): DataFrame with category counts.
        absenceSamples (int): Number of absence samples.
        presenceSamples (int): Number of presence samples.

    Returns:
        pd.DataFrame: Adjusted DataFrame with binary class counts.


    Adjust strata DataFrame for binary classification based on required sample
    numbers.

    Args:
        strata_df (pd.DataFrame): DataFrame with category counts.
        requiredNumberPresenceSamples (int): Required number of presence samples.
        estimatedPercentPresenceTarget (float): Estimated percentage of presence
        target.
        requiredNumberAbsenceSamples (int): Required number of absence samples.
        estimatedAbsenceTarget (float): Estimated percentage of absence target.

    Returns:
        pd.DataFrame: Adjusted DataFrame with binary class counts.


    MarginOfError: or "d" is the desired half-width of the confidence interval
    anticipatedAcc: or "p" is the anticipated overall accuracy in the case of
    simple random sampling,
                    or anticipated user'saccuracy in the case of stratified
                    sampling where we determine
                    the sample size nh for each stratum.

    The Olofsson method is programmed largely based on this reference:
    "https://www.openmrv.org/web/guest/w/modules/mrv/modules_3/sampling-design-
        for-estimation-of-area-and-map-accuracy"

    qh: the proportion of stratum h that really falls in the target class
    (related to strata map accuracy).
    SDh: the standard deviation of stratum h, calculated from qh.
    wh: strata weights, the number of pixels of a stratum to the total number of
    pixels in that study area.
        This is derived from the strata image.
    SDh_x_wh: SDh * wh, which facilitates the calculateion of n (see "3.3.1
    Sample size" in the link above).

    targerSE: the target Standard Error, calculated from user specified
    MarginOfError, ConfidenceLevel, and


    Allocate the absence and presence samples into multiple categories
    (sub-classes),    guided by the user-specified absenceSampleWeights and
    presenceSampleWeights.
    For example, if presenceSampleWeights = [0.3, 0.7] and the presence sample
    size is 100, then the presence samples will be split as [30, 70].

    return: three items: strata_df_mltcat with distributed samples, sampleSize


    Convert Earth Engine FeatureCollection to a CSV DataFrame.

    Args:
        sample_fc (ee.FeatureCollection): Earth Engine FeatureCollection.

    Returns:
        pd.DataFrame: DataFrame containing sample data.


    Remove unwanted categories and set their sample counts to zero.

    Args:
    mltcat_old (pd.DataFrame): DataFrame with multi-class counts.

    Returns:
    pd.DataFrame: DataFrame with unwanted categories sample counts set to zero.


    Load a single csv file into a pandas dataframe.
    - args:
    csv_path: the path (str) to the CSV file to be loaded
    - return:
    csv_data: a pandas DataFrame containing the data from the CSV file.


    Keep the selected columns only.
    -args:
    df: a pandas dataframe
    col_list: list of selected columns
    - return: a pandas dataframe with only selected columns


    Update a pandas dataframe's column names use a dictionary. The function will
    raise a ValueError if the user asks to change a column name that does not
    exist.
    -args:
    df: a pandas dataframe
    update_dict: a dictionary with {old_name: new_name}
    return: a pandas dataframe with updated column names


    Create a concensus label called "mode_label" based on the most freqent label
    (mode) across labelers.
    When there is a complete disagreement among labelers, give -9999


    Check and modify CSV files based on the sum of values in specified columns.

    This function iterates through a list of CSV files and checks the sum of
    values in specified columns. If the sum of values in the columns is not
    equal to 100 for any row, it identifies and removes the
    problematic rows from the related CSV file.

    - args:
    fs: A list of file paths to the CSV files to be processed.
    rename_dict: A dictionary containing column names.


    Create a new column called label. Fill this class column based on labels
    *Use check_exclusive() first to make sure there is one and only
    one column = 100.

    -args:
    df: a pandas dataframe
    recode_dict: a dictionary with {col1:[old_value,new_value], col2:[old_value,
    new_value]}

    return: a pandas dataframe with recode values


    user 1's label will be like "label_1";
    user 2 is "label_2" etc...


    A csv processing pipeline. This function takes a single csv file
    and let it pass through a sequence of our pre-defined functions
    return: a pandas dataframe of the processed csv.


    Compare the content of multiple CSV files and identify differences in the
    data.
    - file_path (list of str): A list of file paths to the CSV files to be
    compared.


    Process a CSV file, rename columns, and create new column categories.

    Takes: file_path (list of str): A list of file paths to the CSV files to be
    processed.

    Returns:
    new_col_names (list of str): A list of new column names.
    rename_dict (dictionary of str): A dictionary which the keys are old column
    names and values are the new column names.


    A wrapper of asf_search.geo_search with following modifications:
        1. Take a vector-based spatial data format (e.g., shapefile, GeoJSON, etc.) as the input for AOI rather than using WKT.
        2. Simplify the geometric object (e.g., polygon) so that ASF SearchAPI won't run out of time.
        3. Return search results as a GeoDataFrame.


    A wrapper of asf_search.granule_search with following modifications:
        1. Return search results as a GeoDataFrame.
        2. Convert pathNumber and frameNumber to int type.
        3. Convert startTime and stopTime to datatime type.


    Extract inner edges of an image mask.
    An inner edge pixel is defined as:
        pixel value = 1 & at least one adjacent (rook's case) pixel is 0

    Parameters
    ----------
    mask: uint8 np.array
        Image mask.

    Returns
    -------
    edge: uint8 np.array
        Inner edges.


    Identify side (left/right or top/bottom) inner edges for an image mask that
    is somewhat rectangular (e.g., a mask for a radar swath).

    Parameters
    ----------
    mask: uint8 np.array
        Image mask.

    left_and_right: bool
        True to return left/right edges; False to return top/bottom edges.

    Returns
    -------
    side_edge: uint8 np.array
        Side edges.


Convert geom strs from the Postgis HEXEWKB format to WKB.


Load each CSV from the DATA_DIR.


Make a base plot of the Greenland map.


Plot a list of geoms string on the map base with the given color.


Plot a pair of crossovers.


Find the distance between two crossovers.


Match the crossovers between the pairs to the closest crossover in the other pair.


    Produce a label given a pair of segments
    such that `label_pair(seg1_name, seg2_name) == label_pair(seg2_name, seg1_name)`.


Group data from crossover sets into pairs of segments.


Compare two sets of crossovers and find the distances between crossovers.


Run a query against the postgres database identified in postgres-conn.json


    Retrieve the segments information for all segments from the database and write
    to a CSV in the DATA_DIR.

    current_resolution : The resolution of the current database for marking the CSV
    system: the system from which to query segments.


    Retrieve the crossover information for all crossovers from the database and write
    to a CSV in the DATA_DIR.

    current_resolution : The resolution of the current database for marking the CSV
    system: the system from which to query crossovers.


    Retrieve the segments information for two provided segments from the database
    and write to a CSV in the DATA_DIR.

    current_resolution : The resolution of the current database for marking the CSV
    system: the system from which to query segments.
    segments: a tuple of two segments to retrieve information for.


    Retrieve the crossover information for two provided segments from the database
    and write to a CSV in the DATA_DIR.

    current_resolution : The resolution of the current database for marking the CSV
    system: the system from which to query crossovers.
    segments: a tuple of two segments to retrieve information for.


Remove all crossovers from the database.

    system: the system from which to delete crossovers.


 The interface function takes the same input as the agenda, in the
    same order.  The output must also match the agenda output.

    To see the input and outputs of an Agenda, write ws.agenda? in an ipython
    terminal or check in the pyarts documentation - especially the
    call-operator of agendaOperator classes describe in full the interface

    Anyways, the agenda propagation_matrix_agenda takes:
        a frequency grid
        a wind-shift-jacobian
        the jacobian target lists
        a selection of absorption species
        a ray path point
        the atmospheric state

    it outputs:
        propmat
        source-vec
        propmat-jacobian
        source-vec-jacobian

    The below demonstrates an incredibly easy way to set up these calculations.

    It is not intent for anything but documenting the idea, you need to fill
    this up yourself!


return a numpy array of spherical harmonic coefficients (complex). Adress coefficients with index sh.idx(l,m)
    	   if optional argument im is given, the spectral array is restricted to order im*mres.


    	spectral to spatial transform, for scalar or vector data.
    	v = synth(qlm) : compute the spatial representation of the scalar qlm
    	vtheta,vphi = synth(slm,tlm) : compute the 2D spatial vector from its spectral spheroidal/toroidal scalars (slm,tlm)
    	vr,vtheta,vphi = synth(qlm,slm,tlm) : compute the 3D spatial vector from its spectral radial/spheroidal/toroidal scalars (qlm,slm,tlm)


    	spatial to spectral transform, for scalar or vector data.
    	qlm = analys(q) : compute the spherical harmonic representation of the scalar q
    	slm,tlm = analys(vtheta,vphi) : compute the spectral spheroidal/toroidal scalars (slm,tlm) from 2D vector components (vtheta, vphi)
    	qlm,slm,tlm = synth(vr,vtheta,vphi) : compute the spectral radial/spheroidal/toroidal scalars (qlm,slm,tlm) from 3D vector components (vr,vtheta,vphi)


(vtheta,vphi) = synth_grad(sht self, slm) : compute the spatial representation of the gradient of slm


    	spectral to spatial transform, for complex-valued scalar or vector data.
    	z = synth(zlm) : compute the complex-valued spatial representation of the scalar zlm
    	vtheta,vphi = synth(slm,tlm) : compute the complex-valued 2D spatial vector from its spectral spheroidal/toroidal scalars (slm,tlm)
    	vr,vtheta,vphi = synth(qlm,slm,tlm) : compute the complex-valued 3D spatial vector from its spectral radial/spheroidal/toroidal scalars (qlm,slm,tlm)


    	spatial to spectral transform, for complex-valued scalar or vector data.
    	zlm = analys(z) : compute the spherical harmonic representation of the complex scalar z
    	slm,tlm = analys(vtheta,vphi) : compute the spectral spheroidal/toroidal scalars (slm,tlm) from complex-valued 2D vector components (vtheta, vphi)
    	qlm,slm,tlm = synth(vr,vtheta,vphi) : compute the spectral radial/spheroidal/toroidal scalars (qlm,slm,tlm) from complex-valued 3D vector components (vr,vtheta,vphi)


zidx(sht self, int l, int m) -> int : compute the index l*(l+1)+m in a complex spherical harmonic expansion


zlm(sht self, int idx) -> (int,int) : returns the l and m corresponding to the given index in complex spherical harmonic expansion


		Load sphere data stored in physical space from .csv file

		Return:
		-------
			Tuple with (data, longitude angles, latitude angles)


Create a tensor of dimension n.

    Create a tensor with n dimensions with two entries in each dimension.
    The tensor is filled with increasing integers starting with 0.

    Args:
        n (int): number of dimensions

    Returns:
        np.ndarray: n-dimensional tensor


Return the appropriate `GriddedField` type for given dimension.


Helper for test_to_dict and test_to_xarray


Collect all XML files in the ARTS XML data tree.


Create an empty tensor of dimension n.

    Create a tensor with n dimensions of size 0.

    Args:
        n (int): number of dimensions

    Returns:
        np.ndarray: n-dimensional tensor


Delete temporary file.


Returns a dict of all files in the path as a list and all folders as a dict


Converts a list of paths to rst string


    Download and extract data files.

    This function sets the ARTS data search path to the downloaded
    data directories, so that ARTS can find the required data files.

    If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set,
    it is assumed that the user wants to use their own catalog locations
    and this function does nothing.

    Parameters:
        data (Tuple[str]):
            List of data types to download. Possible values are:
            - ``"xml"``: arts-xml-data package
            - ``"cat"``: arts-cat-data package
        download_dir (str, optional):
            The directory where the data files will be stored.
            If not provided, the default is ``~/.cache/arts/``.
        verbose (bool, optional):
            Whether to print info messages. Defaults to False.
        **kwargs:
            Additional options passed on to the data specific download functions, e.g.
            ``version`` for ARTS catalogs.


    Downloads a zip file from a given URL and extracts it to a specified directory.

    Parameters:
        url (str): The URL of the zip file to download.
        extract_dir (str, optional): The directory to extract the zip file to. Defaults to ".".
        verbose (bool, optional): Whether to print info messages. Defaults to False.


    Download and extract the ARTS XML and catalog data files from github.

    This function sets the ARTS data search path to the downloaded
    data directories, so that ARTS can find the required data files.

    If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set,
    it is assumed that the user wants to use their own catalog locations
    and this function does nothing.

    Parameters:
        download_dir (str, optional):
            The directory where the data files will be stored.
            ggkIf not provided, the default is `~/.cache/arts`.
        version (str, optional):
            The version of ARTS to download the data files for. The default
            is the version of the currently installed pyarts package.
        verbose (bool, optional):
            Whether to print info messages. Defaults to False.


    Download and extract the ARTS XML data files from github.

    This function sets the ARTS data search path to the downloaded
    data directories, so that ARTS can find the required data files.

    If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set,
    it is assumed that the user wants to use their own catalog locations
    and this function does nothing.

    Parameters:
        download_dir (str, optional):
            The directory where the data files will be stored.
            ggkIf not provided, the default is `~/.cache/arts`.
        version (str, optional):
            The version of ARTS to download the data files for. The default
            is the version of the currently installed pyarts package.
        verbose (bool, optional):
            Whether to print info messages. Defaults to False.


    Download and extract the ARTS catalog data files from github.

    This function sets the ARTS data search path to the downloaded
    data directories, so that ARTS can find the required data files.

    If the environment variable ARTS_DATA_PATH or ARTS_INCLUDE_PATH is set,
    it is assumed that the user wants to use their own catalog locations
    and this function does nothing.

    Parameters:
        download_dir (str, optional):
            The directory where the data files will be stored.
            ggkIf not provided, the default is `~/.cache/arts`.
        version (str, optional):
            The version of ARTS to download the data files for. The default
            is the version of the currently installed pyarts package.
        verbose (bool, optional):
            Whether to print info messages. Defaults to False.


    Populates a ~pyarts.arts.AtmField from an xarray Dataset-like structure

    Parameters
    ----------
    data : xarray.Dataset
        A dataset.  Coordinates should contain 'alt', 'lat', and 'lon'.
        All other keys() should be assignable to the atm-field by name.
    remap : None | dict[str, str], optional
        All names in this optional dict are renamed when accessing the dataset.
        For example, if the altitude-grid is called 'Alt' instead of 'alt', the
        dict should contain {..., 'alt': 'Alt', ...}.
    ignore : None | list[str], optional
        Ignore keys listed from assignment into the atmospheric field.
    atm : None | pyarts.arts.AtmField
        The default atmospheric field to use.  Defaults to None to use default-
        constructed atmospheric field object.

    Returns
    -------
    atm : pyarts.arts.AtmField
        An atmospheric field


Scans the ARTS data path for species relevant to the given atmospheric field.

    The scan is done over files in an arts-cat-data like directory structure.

    Args:
        atm_field (pyarts.arts.AtmField): A relevant atmospheric field.

    Returns:
        pyarts.arts.ArrayOfArrayOfSpeciesTag: All found species tags.
        The intent is that this is enough information to use pyarts.workspace.Workspace.ReadCatalogData


Wraps xarray.open_dataset to search for files in the current and in ARTS' data path.

    All args and kwargs are passed on to xarray.open_dataset directly.  Any FileNotFoundError
    will be caught and just raised if no path works.

    Args:
        filename_or_obj (_type_): _description_

    Raises:
        FileNotFoundError: _description_

    Returns:
        _type_: _description_


Convert an isotoplogue index to a HITRAN char for that index


 Generates a version of latest_molparam_map used in hitran_species.cc

    The variable is simply printed to stream with print() as the intent is
    to use this output in ARTS directly.  ARTS does not use AFGL notation
    internally, but species names that are different from Hitran are mapped to
    ARTS names in the output.


Calculate the full-width at half maximum (FWHM) of an absorption line.

    Parameters:
        f (ndarray): Frequency grid.
        a (ndarray): Line properties
            (e.g. absorption coefficients or cross-sections).

    Returns:
        float: Linewidth.

    Examples:
        >>> f = np.linspace(0, np.pi, 100)
        >>> a = np.sin(f)**2
        >>> linewidth(f, a)
        1.571048056449009


Calculate the doppler broadening half-width half-maximum

    .. math::
        \\gamma_D(T) = \\sqrt{ \\frac{2\\log(2) k_B T}{mc^2} } f_0

    Parameters:
        t (float or ndarray): Temperature [Kelvin]

        f0 (float or like temperature): Central frequency [Hertz/invcm]

        m (float or like temperature): Mass [kilogram]

    Returns
        hwhm (like temperature): Half-width half-maximum [Hertz/invcm]


Computes the Boltzmann level function

    .. math::
        K_1 = \\exp\\left(\\frac{E_l \\left[T-T_0\\right]}{k_B T T_0}\\right),

    where :math:`k_B` is the Boltzmann constant.

    All ndarrays must be of same size, any of the inputs can be ndarray

    Parameters:
        elow (float or ndarray): Lower state energy level [J]

        t (float or ndarray): Temperature [Kelvin]

        t0 (float or ndarray): Line temperature [Kelvin]

    Returns
        K1 (like input): How much Boltzmann statistics feeds the transition

    .. math::
        S(T) = S(T_0)K_1K_2 \\frac{Q(T_0)}{Q(T)}


Computes the stimulated emission function

    .. math::
        K_2 = \\frac{1 - \\exp\\left( - \\frac{h f_0}{k_B T}\\right)}
        {1 - \\exp\\left( - \\frac{h f_0}{k_B T_0}\\right)},

    with Planck constant :math:`h` and Boltzmann constant :math:`k_B`.

    Parameters:
        f0 (float or ndarray): Line frequency [Hz]

        t (float or ndarray): Temperature [Kelvin]

        t0 (float or ndarray): Line temperature [Kelvin]

    Returns
        K2 (like input): How stimulated the emission is

    .. math::
        S(T) = S(T_0)K_1K_2 \\frac{Q(T_0)}{Q(T)}


    Interpolates the given data using the specified lags.

    Args:
        data: The data to be interpolated.
        *lags: Variable number of lags to be used for interpolation.

    Returns:
        The interpolated data.


    Reinterprets the data array using interpolation for each left-most index.

    Parameters:
    data (numpy.ndarray): The input data array.
    *lags (float): Variable number of lag values used for interpolation.

    Returns:
    numpy.ndarray: The reinterpreted data array.


        Interpolate the given values `x` onto the grid defined by `self.grid`.

        Parameters:
            x (array-like): The values to be interpolated.
            **kwargs: Additional keyword arguments.

        Returns:
            tuple: A tuple containing two elements:
                - A list of two indices representing the interpolated positions.
                - The interpolated values on the grid.

        Raises:
            None.


            Interpolate the field to a given point or set of points.

            Parameters:
            - x: The point or set of points to interpolate the field to.
            - iw_kwargs: Additional keyword arguments for the interpolation.

            Returns:
            - See `func:regular_grid.iw`.


            Interpolate the field to a given point or set of points.

            Parameters:
            - x: The point or set of points to interpolate the field to.
            - **iw_kwargs: Additional keyword arguments for the interpolation.

            Returns:
            - See `func:regular_grid.iw`.


A list of the compatible ARTS groups

    Parameters
    ----------
    args : object
        Any python object
    kwargs : object
        Any python objects

    Returns
    -------
    out : list
        All possible ARTS workspace groups that can be constructed from var


Internal source code parser


Creates a callback operator


 Converts a value into something that can be turned into an Arts group

    This is intended to be used purely by a function parsing old controlfiles


Unindent source code.

    Determines indent level of the first line and unindents
    all lines by the found indent level.

    Args:
        source: The source code to unindent as a string as
            obtained for example from inspect.getsource.

    Raises:
        Exception: If the non-whitespace characters are detected
            in the characters that are stripped off the code lines.

    Returns:
        new_source: The unindented source code.


Return the name and the value of an attribute


Return a value of an expression


    Creates the method that assings a value to the workspace by copy or set

    The current global state is used when RHS is a Name or a Call,
    otherwise literal evaluation is performed to return the value

    Currently set up to handle:

    1) ws.LHS = RHS
    2) ws.LHS = ws.RHS
    3) ws.LHS = <literal>
    4) ws.LHS = <call>

    where LHS is any workspace variable.  Named or not.

    RHS has the following limitations:

    1) RHS must be a value in globals(), its value is parsed and copied.
       The copied value must be possible to assign to LHS.  So if LHS is
       an existing workspace variable, RHS can construct it.  Otherwise,
       RHS must be a workspace group.
    2) None, the assignment will fail upon execution of the method if the two
       workspace variables are of different workspace groups.
    3) <literal> is the catch-all.  If nothing else works, the <literal>
       expression is evaluated at the end to try and evaluate its value before
       returning the method.
    4) Any function call that has a single return value.  The function call
       lives in the globals().  The return value has the same limitation as RHS
       in case 1).


Return all arguments and their types of a method in order of appearance


Get the value of an argument or its name


    Parse all positional arguments of a user-defined method and fill out
    the dict required by the method constructor


Parse and append all named arguments of a user-defined method


    Evaluate the call as an ARTS method.  If this is not an ARTS method,
    the CallbackOperator should be copied onto the workspace and the
    CallbackOperatorExecute method should be executed (WIP)


An expression is bad unless it is a call, in which case it is forwarded


Parse the agenda method list.  We can only have assignments and expressions


    Core workspace method interpreter returning a list of Method and str

    If any str is there, the parsing failed and a future test will produce
    the appropriate error message


Returns the name of the workspace


Returns an agenda or deal with the error


Internal source code parser


    Creates an agenda by parsing the supported expressions into
    Workspace Method calls.

    Examples
    --------

    These all produce the same Agenda, with minor modifications on how
    it is stored.

    .. code-block:: python
       :caption: Creating a basic Agenda

       from pyarts.workspace import Workspace, arts_agenda, callback_operator

       @arts_agenda
       def propmat_clearsky_agenda(ws):
           ws.propmat_clearskyInit()
           ws.propmat_clearskyAddLines()
           ws.Ignore(ws.rtp_los)

       ws = Workspace()
       ws.propmat_clearsky_agenda = propmat_clearsky_agenda

    .. code-block:: python
       :caption: Setting an agenda to a workspace directly

       from pyarts.workspace import Workspace, arts_agenda, callback_operator

       ws = Workspace()

       @arts_agenda(ws=ws)
       def propmat_clearsky_agenda(ws):
           ws.propmat_clearskyInit()
           ws.propmat_clearskyAddLines()
           ws.Ignore(ws.rtp_los)

    .. code-block:: python
       :caption: Setting an Agenda while skipping some housekeeping

       from pyarts.workspace import Workspace, arts_agenda, callback_operator

       ws = Workspace()

       @arts_agenda(ws=ws, fix=True)
       def propmat_clearsky_agenda(ws):
           ws.propmat_clearskyInit()
           ws.propmat_clearskyAddLines()

    .. code-block:: python
       :caption: Using custom values

       from pyarts.workspace import Workspace, arts_agenda, callback_operator

       ws = Workspace()

       @arts_agenda(ws=ws, fix=True)
       def propmat_clearsky_agenda(ws):
           ws.propmat_clearskyInit()
           ws.propmat_clearskyAddLines(ws.propmat_clearsky,  # By pos
                                       lines_sparse_df=0)  # By name

    Additional options
    ------------------

    We support some additional functionality of python beyond just
    calling workspace methods.

    .. code-block:: python
       :caption: Assigning or copying a variable using python syntax

       from pyarts.workspace import Workspace, arts_agenda, callback_operator

       ws = Workspace()

       @arts_agenda(ws=ws, fix=True)
       def propmat_clearsky_agenda(ws):
           ws.propmat_clearsky = []
           ws.x = ws.f_grid

    .. code-block:: python
       :caption: Using callback operators to execute code in python

       from pyarts.workspace import Workspace, arts_agenda, callback_operator

       def fun(f_grid):
           x = f_grid
           return x

       ws = Workspace()

       @arts_agenda(ws=ws, fix=True)
       def propmat_clearsky_agenda(ws):
           fun()  # This will set x to f_grid

    Parameters
    ----------
    func : function
        The function to be turned into an Agenda
    ws : ~pyarts.workspace.Workspace, optional
        The workspace to put this onto after finalization, defaults to None
    fix : bool, optional
        Whether to fix missing input/output in finalization, defaults to False


Decorator which can be used to mark functions as deprecated.

    Examples:
        Calling ``foo()`` will raise a ``DeprecationWarning``.

        >>> @deprecated
        ... def deprecated_function():
        ...     pass

        Display message with additional information:

        >>> @deprecated(message='Additional information message.')
        ... def deprecated_function():
        ...     pass


Save a variable to an ARTS XML file.

    Args:
        var: Variable to be stored.
        filename (str): Name of output XML file.
            If the name ends in .gz, the file is compressed on the fly.
        precision (str): Format for output precision.
        format (str): Output format: 'ascii' (default) or 'binary'.
        comment (str): Comment string included in a tag above data.
        parents (bool): Create missing parent directories.

    Note:
        Python's gzip module is extremely slow in writing. Consider
        compressing files manually after writing them normally.

    Example:
        >>> x = numpy.array([1.,2.,3.])
        >>> pyarts.xml.save(x, 'myvector.xml')


Load a variable from an ARTS XML file.

    The input file can be either a plain or gzipped XML file.

    By default, the current directory, ARTS_INCLUDE_PATH and ARTS_DATA_PATH
    environment variables are searched (in that order) if the passed filename is
    a relative path.

    Args:
        filename (str): Name of ARTS XML file.
        search_arts_path (bool): Set to False to ignore ARTS search paths.

    Returns:
        Data from the XML file. Type depends on data in file.

    Example:
        >>> pyarts.xml.load('tests/reference/matrix.xml')
        array([[ 0.,  1.],
               [ 2.,  3.]])


Load all XML files in a given directory.

    Search given directory  for files with ``.xml`` or ``.xml.gz`` extension
    and try to load them using :func:`load`.

    Parameters:
        directory (str): Path to the directory.
        exclude (Container[str]): Filenames to exclude.

    Returns:
        dict: Filenames without extension are keys for the file content.

    Example:
        Load all files in ``foo`` except for the lookup table in
        ``abs_lookup.xml.``

        >>> load_directory('foo', exclude=['abs_lookup.xml'])


Load all indexed XML files matching the given filename.

    The function searches all files matching the pattern
    ``<filename>.<file_index>.xml`` or ``<filename>.<file_index>.xml.gz``.

    A list with the loaded file contents is returned. The list indices are
    equivalent to the file indices.

    Parameters:
        filename (str): Filename.

    Returns:
        list: List of file contents.

    Example:
        Load all files matching the pattern ``foo.<file_index>.xml``.

        >>> load_indexed_xml('foo')


Loads xml-file at filename and saves it back in binary format

    Parameters:
        filename (str): Filename path.
        out (str): Path to save the binary.  Empty causes overwrite of file.
        absolute_out (bool): If true, then write file to out-path rather than
            to the relative path out.  Does nothing if file is in the working
            folder and out is relative.
        parents (bool): Create missing parent directories.

    Returns:
        str: Path to the created binary file.

    Example:
        Load t_field.xml and save it back as binary it as ./binary/t_field.xml
        and ./binary/t_field.bin

        >>> make_binary('t_field.xml', out='binary')
        'binary/t_field.xml'


Loads xml-files in directory and saves them back in binary format

    Parameters:
        directory (str): Directory path.
        out (str): Path to save the binary.
        absolute_out (bool): If true, then write file to out-path rather than
            to the relative path out.  Does nothing if file is in the working
            folder and out is relative.
        parents (bool): Create missing parent directories.

    Returns:
        list[str]: Paths to the created binary files.

    Example:
        Load arts-xml-data/spectroscopy/cia/hitran2011/ and save it back as
        binary it at arts-xml-data-binary/spectroscopy/cia/hitran2011/

        >>> make_directory_binary('arts-xml-data/spectroscopy/cia/hitran2011',
            out='arts-xml-data-binary/spectroscopy/cia/hitran2011',
            absolute_out=True)
        ['arts-xml-data-binary/spectroscopy/cia/hitran2011/hitran_cia2012_adapted.xml']


 Updates a file to the latest version of ARTS

    Wraps load()+save() from higher up in this file

    Only works for absolute paths.  To ensure the path is absolute,
    os.path.abspath is applied on filename as the first operation

    Attempts to store the file in the same format as it was read by, clobbering
    the original file.

    Parameters:
        filename (str): Filename path.
        precision (str): Format for output precision.


 Update all files in a directory

    Wraps update() from higher up in this file for all files ending with
    .xml in the given directory

    Only works for absolute paths.  To ensure the path is absolute,
    os.path.abspath is applied on directory as the first operation

    There is a subset of .xml files that cannot be read by standard ARTS but
    requires specialized functions from within ARTS to be read.  For example,
    the old Artscat-N format line catalog files.

    Parameters:
        directory (str): Directory path.
        precision (str): Format for output precision.

    Returns:
        A dict of files with failed conversions and their error representations


Plot the atmospheric field parameters in a default manner.

    Args:
        atm_field (pyarts.arts.AtmField): An atmospheric field
        fig (optional): The matplotlib figure to draw on. Defaults to None for new figure.
        alts (optional): A grid to plot on - must after broadcast with lats and lons be 1D. Defaults to np.linspace(0, 1e5).
        lats (optional): A grid to plot on - must after broadcast with alts and lons be 1D. Defaults to 0.
        lons (optional): A grid to plot on - must after broadcast with alts and lats be 1D. Defaults to 0.
        ygrid (optional): Choice of y-grid for plotting.  Uses broadcasted alts if None. Defaults to None.
        keys (optional): A list of keys to plot. Defaults to None for all keys in keys().

    Returns:
        fig: as input or a new figure
        subs: list of subplots


Just the polar plots required by :func:`polar_ray_path`.

    Parameters
    ----------
    rad : np.array
        List of radiuses [in meters].
    tht : np.array
        List of angles [in radian].
    planetary_radius : float
        A planetary radius in same unit as rad.
    rscale : float
        This will rescale values.  As rad is in meters, rscale=1000 means that
        the scale is now in kilometers.  See :func:`polar_ray_path_rad_unit` for
        good options
    ax : Axes, optional
        The axis to draw at. The default is None, which generates a default
        polar coordinate.

    Returns
    -------
    ax : As input
        As input.


Returns the radial unit

    Parameters
    ----------
    rscale : float
        1.0 for "m", 1000 for "km", 1e6 for "Mm.
        Otherwise returns "???"

    Returns
    -------
    str
        The unit or "???".


Basic plot for ray_path latitudes

    Parameters
    ----------
    rad : np.array
        List of radiuses [in meters]
    lat : np.array
        List of latitudes [in radian].
    planetary_radius : float
        A planetary radius in same unit as rad.
    rscale : A rescaler for the radius
        This will rescale values.  If rad is in meters, rscale=1000
        means that the scale is now in kilometers
    ax : Axes, optional
        The axis to draw at. The default is None, which generates a
        default polar coordinate.

    Returns
    -------
    ax : As input.
        As input


Basic plot for ray_path longitudes

    Parameters
    ----------
    rad : np.array
        List of radiuses [in meters]
    lon : np.array
        List of longitudes [in radian].
    planetary_radius : float
        A planetary radius in same unit as rad.
    rscale : A rescaler for the radius
        This will rescale values.  If rad is in meters, rscale=1000
        means that the scale is now in kilometers
    ax : Axes, optional
        The axis to draw at. The default is None, which generates a
        default polar coordinate.

    Returns
    -------
    ax : As input.
        As input


Basic plot for ray_path longitudes

    Parameters
    ----------
    lat : np.array
        List of latitudes [in degrees]
    lon : np.array
        List of longitudes [in degrees].
    ax : Axes, optional
        The axis to draw at. The default is None, which generates a
        default polar coordinate.

    Returns
    -------
    ax : As input.
        As input


Basic plot for ray_path zeniths

    Parameters
    ----------
    za : np.array
        List of Zenith angles [in radians]
    ax : Axes, optional
        The axis to draw at. The default is None, which generates a
        default polar coordinate.

    Returns
    -------
    ax : As input.
        As input


Basic plot for ray_path azimuths

    Parameters
    ----------
    aa : np.array
        List of Azimuth angles [in radians]
    ax : Axes, optional
        The axis to draw at. The default is None, which generates a
        default polar coordinate.

    Returns
    -------
    ax : As input.
        As input


Unwraps the lat and lon for plotting purposes.  This is a helper func

    Parameters
    ----------
    lon : np.array
        A list of latitudes.
    lat : np.array
        A list of longitudes.

    Returns
    -------
    list
        one or more pairs of [lon, lat] that when plotted does not allow
        wrapping.


Get the default figure by standard inputs

    Parameters
    ----------
    figure_kwargs : dict, optional
        Arguments to put into plt.figure().

    Returns
    -------
    A matplotlib figure, optional
        A figure


Get the default axes

    Parameters
    ----------
    fig : Figure
        A figure
    draw_lat_lon : bool, optional
        Whether or not latitude and longitude vs radius angles are drawn.
        Def: True
    draw_map : bool, optional
        Whether or not latitude and longitude map is drawn.  Def: True
    draw_za_aa : bool, optional
        Whether or not Zenith and Azimuth angles are drawn.  Def: False

    Returns
    -------
    A list of five Axes
        A tuple of five axis.

        The order is [lat, lon, map, za, aa]


Plots a single observation in a polar coordinate system

    Use the draw_* variables to select which plots are done

    The polar plots' central point is at the surface of the planet, i.e., at
    planetary_radius/rscale.  The radius of these plots are the scaled down
    radiuses of the input ray_path[0].pos[0] / rscale + planetary_radius/rscale.
    The default radius value is thus just the altitude in kilometers.  If you
    put, e.g., 6371e3 as the planetary_radius, the radius values will be the
    radius from the surface to the highest altitude

    Note also that longitudes are unwrapped, e.g. a step longer than 180
    degrees between ray_path points will wrap around, or rather, create separate
    entries of the lat-lons.

    Parameters
    ----------
    ray_path : pyarts.arts.ArrayOfPropagationPathPoint
        A single propagation path object
    planetary_radius : float, optional
        See :func:`polar_ray_path_helper`
    rscale : float, optional
        See :func:`polar_ray_path_helper`
    figure_kwargs : dict, optional
        Arguments to put into plt.figure(). The default is {"dpi": 300}.
    draw_lat_lon : bool, optional
        Whether or not latitude and longitude vs radius angles are drawn.
        Def: True
    draw_map : bool, optional
        Whether or not latitude and longitude map is drawn.  Def: True
    draw_za_aa : bool, optional
        Whether or not Zenith and Azimuth angles are drawn.  Def: False
    fig : Figure, optional
        A figure. The default is None, which generates a new figure.
    axes : A list of five Axes, optional
        A tuple of five axis. The default is None, which generates new axes.
        The order is [lat, lon, map, za, aa]

    Returns
    -------
    fig : As input
        As input.
    axes : As input
        As input.


Plot the sensor obsel array in a default manner.

    .. note::
        Any option other than "f" will sort the sensor obsel array by the
        corresponding key. The object lives via a pointer, so the original
        measurement_sensor is modified in-place.

        This should not massively affect any radiative transfer computations,
        but it might result in different results down on the floating point
        epsilon error level.

    Args:
        measurement_sensor (pyarts.arts.MeasurementSensor): A sensor observation element array
        fig (optional): The matplotlib figure to draw on. Defaults to None for new figure.
        subs (optional): List of subplots to add to. Defaults to None for a new subplot.
        keys (str, list): The keys to use for plotting. Options are in pyarts.arts.SensorKeyType.
        pol (str): The polarization to use for plotting. Defaults to "I", constructs a pyarts.arts.Stokvec.
    Returns:
        fig: as input or a new figure
        subs: list of subplots


Plots the time report.

    The time report is available only when
    ARTS has been compiled with the CMake option ``-DENABLE_ARTS_PROFILING=OFF``,
    which is not part of the default distribution.

    Nevertheless, there is enough helpful parts in being able to see the
    state of parallelism and report the time of internal methods that
    this method is part of the distribution.

    Parameters
    ----------
    clear : bool, optional
        Whether or not to clear the time-report.  Default is True.
    scale : float, optional
        The scale of the time axis, defaults to 1.0.
    fig : matplotlib figure, optional
        The figure to draw on in a plotting mode.  By default creates a new figure.

    Return
    ------
    r : dict
        The time report
    *out : tuple
        If mode is "plot", returns the matplotlib figure and axis.
        If mode is "table", returns a string containing the time report in Markdown table format.


Prints the time report in text format.

    Parameters
    ----------
    res : dict
        The flattened time report.
    dt : dict
        The time report with the minimum time for each method.

    Returns
    -------
    str
        A string containing the time report in Markdown table format.


Download a file from a URL to a destination file.


Download a file from a URL to a destination file with retries.


Subset a xarray data array by x and y
    da  data array

    subset  [x1,y1,x2,y2] # coordinate for two points describing subset extent

    Uses da.transform to compute indices used for subsetting

    e.g.
    da.transform
       (20.0, 0.0, 241980.0, 0.0, -20.0, 748040.0)

    Raises ValueError if subset bounds are outside the data array boundaries


Creates a GeoTIFF image from a numpy array
    Name       name of output image
    Array      Numpy 2D (y,x) or 3D (z,y,x) array
    DataType   gdal datatype corresponding with the Array. See ?gdal.GDT...
                    Will be deternind from Array.dtype if not provided.
    NDV        No data value (default 0)
    bandnames  Optional list ['...','...'] of bandnames (can be one element for 2D)
    ref_image  reference image to get GeoT(ransformation) and Projection info
    GeoT       provide GeoT(ransformation) (overwrites ref_image)
    Projection provide Projection (overwrites ref_image)
    overwrite  set to True if file with Name exists


For display, we want a histogram equalized version


Use Holoviews for an RGB plot of a rgb data array


Returns a SAR power data array time series stack from the Amplitude scale data stack


    select from tiles all tiles that fall between the min and max lat lon values
    e.g.
    minlon,maxlon,minlat,maxlat = -84,-82,70,71
    results in two tiles:
    N71W084,N71W083


    environment      - should match the kernel running, and will be set autmatically
    worker profile   - 'Small Worker', 'Medium Worker', or 'Pangeo Worker' (determines available memory in a worker)
    profile          - 'default' is good, but others can be used
    region           - AWS region
    endpoint         - None by default matches region. Set correct endpoint to s3 buckets
    worker_min       - minumum number of workers (for adaptive scaling)
    worker_max       - maximum number of workers
    adaptive_scaling - Default True. If False, launches worker_max workers
    wait_for_cluster - Default True.
    cfile            - None. Finds aws credentials in this file
    use_existing_cluster - Default True.
    propagate_env    - Default False. Set to True when working with Cloud VRTs


	select from tiles all tiles that fall between the min and max lat lon values
	e.g.
	minlon,maxlon,minlat,maxlat = -84,-82,70,71
	results in two tiles:
	N71W084,N71W083


Return a name based on ULLR extent of the tiles in the selection list


Make the vrts and overviews
	Example:
	aws s3 sync s3://sentinel-1-global-coherence-earthbigdata/ . --exclude "*" --include "N*W*/*summer_vv_COH12',"
	gdalbuildvrt -srcnodata 0 -vrtnodata 0 NA_summer_vv_COH12.vrt */*tif
	gdaladdo -r average -ro NA_summer_vv_COH12.vrt 3 9 27 81
	aws s3 cp NA_summer_vv_COH12.vrt s3://sentinel-1-global-coherence-earthbigdata/NA_summer_vv_COH12.vrt
	aws s3 cp NA_summer_vv_COH12.vrt.ovr s3://sentinel-1-global-coherence-earthbigdata/NA_summer_vv_COH12.vrt.ovr

	Loop over metrics, find the tifs, cache the tifs locally, build vrt, make overviews, write back to bucket


make cloud optimized geotiffs


Make the vrts and overviews
	Example:
	aws s3 sync s3://ebd-sentinel-1-l3-coherence/ . --exclude "*" --include "N*W*/*summer_vv_COH12',"
	gdalbuildvrt -srcnodata 0 -vrtnodata 0 NA_summer_vv_COH12.vrt */*tif
	gdaladdo -r average -ro NA_summer_vv_COH12.vrt 3 9 27 81
	aws s3 cp NA_summer_vv_COH12.vrt s3://ebd-sentinel-1-l3-coherence/NA_summer_vv_COH12.vrt
	aws s3 cp NA_summer_vv_COH12.vrt.ovr s3://ebd-sentinel-1-l3-coherence/NA_summer_vv_COH12.vrt.ovr

	Loop over metrics, find the tifs, cache the tifs locally, build vrt, make overviews, write back to bucket


Connects to ASF DAAC or JPL to retrieve the top level index.html file
	which will be parsed to retrieve a list of all campaings and sites


Numerical differentiation of real valued data up to order 5
  by means of splines. For order<=3, cubic splines are used, else
  5th order splines. Note the time range covered by the result is
  missing 3 (or 5 for order>3) points at the boundaries compared
  to the input. t needs to be strictly increasing.

  :param t:     Sample times.
  :type t:      1D numpy array.
  :param y:     Sample values.
  :type y:      1D numpy array.
  :param order: Order of differentiation.
  :type order:  int


Like spline_deriv_real, but works with complex valued y as well.


Computes the definite integral between bounds [a,b] of a function
  represented by samples contained in arrays t and y. t needs to
  be strictly increasing.

  :param t:     Sample times.
  :type t:      1D numpy array.
  :param y:     Sample values.
  :type y:      1D numpy array.
  :param float a: Lower integration boundary.
  :param float b: Upper integration boundary.


Like spline_integrate_real, but works for complex-valued y as well.


Interpolate real valued data given by the arrays t,y to new t-values
  given by ti, by means of cubic splines. t needs to be strictly
  increasing. Values outside the interval are extrapolated if ext=0, set
  to 0 if ext=1, or raise a ValueError if ext=2


Like spline_interpol_real, but works with complex valued y.


Remove phase jumps to get a continous phase.
  :param phase:     Some phase.
  :type phase:      1D numpy array.

  :returns:         phase plus multiples of pi chosen to minimize jumps.
  :rtype:           1D numpy array.


Throws away data outside the time intarval [tmin, tmax].
    if tmin or tmax are not specified or None, it does not remove
    anything from this side.

    :param tmin: Left boundary cut interval or None.
    :type tmin:  float or None
    :param tmax: Right boundary cut interval or None.
    :type tmax:  float or None


Resamples the timeseries to new times tn.

    :param tn: New sample times.
    :type tn:  1D numpy array or list of float.
    :param ext: How to handle points outside the time interval.
    :type ext: 0 for extrapolation, 1 for returning zero, 2 for ValueError.
    :returns: Resampled time series.
    :rtype:   :py:class:`~.TimeSeries`


Resamples the timeseries to regularly spaced times, with the
    same number of points.
    :returns: Regularly resampled time series.
    :rtype:   :py:class:`~.TimeSeries`


Smooth the data by convoluting with a window function.

    :param fwin: The window function.
    :param tsm:  Smoothing length.
    :type tsm:   float
    :returns:    Smoothed timeseries.
    :rtype:      :py:class:`~.TimeSeries`.


Rescales the time.

    :param float utime: Factor by which to divide times.


    :returns: Wether the data is complex-valued.
    :rtype:   bool


Saves into simple ascii format with 2 collumns (t,y) for real valued
    data and 3 collumns (t, Re(y), Im(y)) for complex valued data.

    :param str fname: File name.


Compute derivative of order<=5 using splines.

    :param int order: Order of differentiation.
    :returns: Differential.
    :rtype:   :py:class:`~.TimeSeries`


Compute the definite integral over the interval [a,b] using
    spline representations. If lower and/or upper bound is not specified,
    use boundary of the timeseries.

    :param a: Lower integration bound or None.
    :type a:  float or None
    :param b: Upper integration bound or None.
    :type b:  float or None


Filter out infinite values.
    :returns: Time series with finit values only.
    :rtype:   :py:class:`~.TimeSeries`


Compute the complex phase of a complex-valued signal such that
    no phase wrap-arounds occur, i.e. if the input is continous, so is
    the output.

    :returns:   Continuous complex phase.
    :rtype:     :py:class:`~.TimeSeries`


Compute the phase velocity, i.e. the time derivative
       of the complex phase.


Smooth timeseries with gaussian filter. If deriv>0,
    smoothed derivatige is computed by convolution with
    gaussian kernel derivative.


Compute the average frequency corresponding to the average
    phase velocity.


Combine several overlapping time series into one. In intervals covered
  by two or more time series, data from the time series that starts earliest
  is used.

  :param series: The timeseries to combine.
  :type series:  list of :py:class:`~.TimeSeries`
  :returns:      The combined time series.
  :rtype:        :py:class:`~.TimeSeries`


Combine several overlapping time series into one. In intervals covered
  by two or more time series, data from the time series that starts latest
  is used. If two segments start at the same time, the longer one gets used.

  :param series: The timeseries to combine.
  :type series:  list of :py:class:`~.TimeSeries`
  :returns:      The combined time series.
  :rtype:        :py:class:`~.TimeSeries`


Combine several overlapping time series into one. In intervals covered
  by two or more time series, which data is used depends on the parameter
  prefer_late.

  :param series: The timeseries to combine.
  :type series:  list of :py:class:`~.TimeSeries`
  :param prefer_late: Prefer data that starts later for overlapping segments
  :type prfer_late:   bool
  :returns:      The combined time series.
  :rtype:        :py:class:`~.TimeSeries`


Resamples a list of timeseries to the largest time interval covered
  by all timeseries, using regularly spaced time. The number of
  sample points is the maximum over all time series.

  :param ts:    The timeseries to resample.
  :type ts:     list of :py:class:`~.TimeSeries`
  :returns:     The resampled time series.
  :rtype:       list of :py:class:`~.TimeSeries`


Compute the instantaneous frequency of a complex signal.
  Optionally, smoothing can be applied before computing the
  derivative and to the result.

  :param signal:    Complex-valued signal.
  :type ts:         py:class:`~.TimeSeries`
  :param tsmooth0:  Smoothing length used to smooth signal.
  :type tsmooth0:   float or None for no smoothing
  :param tsmooth1:  Smoothing length used to smooth result.
  :type tsmooth1:   float or None for no smoothing

  :returns:         Instant. frequency.
  :rtype:           :py:class:`~.TimeSeries`


Remove overlapping segments from a time series in (t,y).
  Only the latest of overlapping segments is kept, the rest
  removed.

  :param t:  times
  :type t:   1d numpy array

  :returns:  strictly monotonic time series.
  :rtype:    :py:class:`~.TimeSeries`


List of all available variables.


Create a geometric unit system, expressed in SI, where the length unit
  is given by ulength, expressed in SI units as well.


Create a geometric unit system, expressed in SI, where the density unit
  is given by udensity, expressed in SI units as well.


Create a geometric unit system, expressed in SI, where the mass unit
  is given by umass, expressed in SI units as well.


  Adds a colorbar with optional label.

  :param image: Object to which the colorbar refers, e.g. the result of imshow.
  :param cax:   Existing colorbar axes, see matplotlibs colorbar().
  :param ax:    Axes where to insert colorbar axes, see matplotlibs colorbar().
  :param label: Colorbar label.
  :param ticks: location of the ticks.

  Unknown keyword arguments are passed to matplotlibs colorbar()

  :returns: Colorbar instance.


Makes a 2D color plot of RegData instances.

  :param var:       2D data to plot.
  :type var:        :py:class:`~.RegData` instance
  :param mask:      Optional mask for the plot.
  :type mask:       :py:class:`~.RegData` or numpy array or None
  :param axes:      Which axes to use for the plot. Defaults to current axes.
  :type axes:       matplotlib.axes instance or None
  :param vmin:      Minimum value for color scale. Defaults to data minimum.
  :type vmin:       float or None
  :param vmax:      Maximum value for color scale. Defaults to data maximum.
  :type vmax:       float or None
  :param units:     Units for x and y coordinates.
  :type units:      float or pair of floats.
  :param cmap:      Colormap to use for the plot.
  :type cmap:       Matplotlib colormap
  :param string interpolation: Interpolation method, see matplotlib imshow().
                    Defaults to nearest point.
  :param bar:       Whether to add a colorbar.
  :type bar:        bool
  :param barlabel:  Label for the colorbar.
  :type barlabel:   string or None
  :param barticks:  Locations of the colorbar ticks. Default: choose automatic.
  :type barticks:   list of floats or None
  :param barshrink: Factor to shrink the colorbar.
  :type barshrink:  float
  :param barextend: Whether to show the colors for out of range values at the
                    ends of the colorbar.
  :type barextend:  str

  Unknown keyword arguments are passed to matplotlibs imshow()

  :returns:         Image object.
  :rtype:           matplotlib.image.AxesImage object.


Makes a 2D image with color components given by 3 RegData instances.

  :param red:       2D data for red component.
  :type red:        :py:class:`~.RegData` instance
  :param green:     2D data for green component.
  :type green:      :py:class:`~.RegData` instance
  :param blue:      2D data for blue component.
  :type blue:       :py:class:`~.RegData` instance
  :param mask:      Optional mask for the plot.
  :type mask:       :py:class:`~.RegData` or numpy array or None
  :param axes:      Which axes to use for the plot. Defaults to current axes.
  :type axes:       matplotlib.axes instance or None
  :param vmax:      Maximum value for color scale. Defaults to data maximum.
  :type vmax:       float or None
  :param units:     Units for x and y coordinates.
  :type units:      float or pair of floats.
  :param string interpolation: Interpolation method, see matplotlib imshow().
                    Defaults to nearest point.

  Unknown keyword arguments are passed to matplotlibs imshow()


Makes a contour plot of RegData instances.

  :param var:     2D data to plot.
  :type var:      :py:class:`~.RegData` instance
  :param levels:  Level contours to draw.
  :type levels:   list of floats
  :param mask:    Optional mask for the data.
  :type mask:     :py:class:`~.RegData` or numpy array
  :param axes:    Which axes to use for the plot. Defaults to current axes.
  :type axes:     matplotlib.axes instance or None
  :param units:   Units for x and y coordinates.
  :type units:    float or pair of floats.
  :param labels:  If True, add lables to contours.
  :type labels:   bool
  :param labelfmt:  Format string for contour labels.
  :type labelfmt:   str or None
  :param neg_solid:  Whether to draw negative contours solid or wtih default.
  :type neg_solid:   bool

  Unknown keyword arguments are passed to matplotlibs contour()

  :returns:       Contour lines.
  :rtype:         QuadContourSet object.


Makes a filled contour plot of RegData instances.

  :param var:     2D data to plot.
  :type var:      :py:class:`~.RegData` instance
  :param levels:  Level contours to draw.
  :type levels:   list of floats
  :param mask:    Optional mask for the data.
  :type mask:     :py:class:`~.RegData` or numpy array
  :param axes:    Which axes to use for the plot. Defaults to current axes.
  :type axes:     matplotlib.axes instance or None
  :param units:   Units for x and y coordinates.
  :type units:    float or pair of floats.

  Unknown keyword arguments are passed to matplotlibs contour()

  :returns:       Contour lines.
  :rtype:         QuadContourSet object.


Samples a vector field for plotting purposes.

  :param vec:     Vector to sample.
  :type vec:      2D vector of 2D :py:class:`~.RegData`
  :param mask:    Optional mask for the data.
  :type mask:     :py:class:`~.RegData` or numpy array
  :param narrows: Desired number of arrows.
  :type narrows:  int
  :param x0:      Sample region lower left coordinate. Default: use data
                  coordinate range.
  :type x0:       length-2 float list/array or None
  :param x1:      Sample region upper right coordinate. Default: use data
                  coordinate range.
  :type x1:       length-2 float list/array or None

  The results of this function are

  cd : length-2 tuple of lists or arrays
    x- and y-coordinates of the samples.
  d : length-2 tuple of lists or arrays
    x- and y-components of sampled vectors.
  vmax : float
    Maximum length of all sampled vectors.
  l : float
    Average distance between sampled vectors.

  :returns:       A tuple (cd,d,vmax,l)


Plots a vector field. Resamples data to get desired number of arrows.

  :param vec:     Data to plot. Must be 2D.
  :type vec:      vector of :py:class:`~.RegData`
  :param mask:    Optional mask for the data.
  :type mask:     :py:class:`~.RegData` or numpy array
  :param narrows: Desired number of arrows.
  :type narrows:  int
  :param vmax:    Maximum length assumed for scaling vectors.
  :type vmax:     float or None
  :param unit:    Unit for both x and y coordinates.
  :type unit:     float
  :param x0:      Sample region lower left coordinate. Default: use data
                  coordinate range.
  :type x0:       length-2 float list/array or None
  :param x1:      Sample region upper right coordinate. Default: use data
                  coordinate range.
  :type x1:       length-2 float list/array or None
  :param axes:    Which axes to use for the plot. Defaults to current axes.
  :type axes:     matplotlib.axes instance or None

  Unknown keyword arguments are passed to matplotlibs quiver()


Plots integral curves of a vector field. Seed positions are choosen
  randomly.

  :param vec:       Data to plot. Must be 2D.
  :type vec:        pair of callable objects.
  :param num_seed:  Desired number of lines.
  :type num_seed:   int
  :param seglength: Length of lines as fraction of figure size.
  :type seglength:  float
  :param seedpos:   Positions where to begin the integral curves or None.
  :type seedpos:    Nx2 numpy array or None
  :param axes:    Which axes to use for the plot. Defaults to current axes.
  :type axes:     matplotlib.axes instance or None
  :param units:     Units for x and y coordinates.
  :type units:      float or pair of floats.

  Unknown keyword arguments are passed to matplotlibs plot()


Plots a TimeSeries object.

  :param ts:    Time series to plot.
  :type ts:     :py:class:`~.TimeSeries` instance
  :param units: Units for t and y coordinates.
  :type units:  float or pair of floats.
  :param axes:    Which axes to use for the plot. Defaults to current axes.
  :type axes:     matplotlib.axes instance or None

  Unknown keyword arguments are passed to matplotlibs plot()

  :returns: Result of matplotlibs plot() function.


Plots grid structure of CompData or RegData objects.

  :param data:      Data for which to plot the structure.
  :type data:       :py:class:`~.RegData` or :py:class:`~.CompData`
  :param units:     Units for x and y coordinates.
  :type units:      float or pair of floats.
  :param axes:      Which axes to use for the plot. Defaults to current axes.
  :type axes:       matplotlib.axes instance or None
  :param edgecolor: Which colors to use for the edges of the components on
                    different levels. Will be repeated if shorter than number
                    of refinement levels.
  :type edgecolor:  list of colors or None
  :param facecolor: Like edgecolor, but for the interior of the components.
  :type facecolor:  list of colors or None

  Unknown keyword arguments are passed to matplotlibs patches.Rectangle()


Set limits of axes to coordinate range of data.

  :param var:     Data from which to take coordinate range.
  :type data:     :py:class:`~.RegData` or :py:class:`~.CompData`
  :param units:   Units for x and y coordinates.
  :type units:    float or pair of floats.
  :param aspect:  Aspect ratio of axes.
  :type aspect:   string or float
  :param axes:    Which axes to adjust. Defaults to current axes.
  :type axes:     matplotlib.axes instance or None


Save current figure in multiple formats.

  :param string name:     Filename without extension.
  :param string formats:  Comma-separated list of file formats.

  Unknown keyword arguments are passed to matplotlibs savefig()


    :returns: the number of dimensions.
    :rtype:   int


    :returns: Whether the extend in each dimension is larger than one
              gridpoint.
    :rtype:   array of bools


    :returns: The number of dimensions with size larger than one
              gridpoint.
    :rtype:   int


Rescale all coordinates.

    :param scale: Factor to scale by.
    :type scale:  float or 1d numpy array


Shift all coordinates.

    :param shift: vector added to the origin.
    :type shift:  float or 1d numpy array


Remove dimensions which are only one gridpoint across


Compute coordinate corresponding to a grid point.

    :param i: Grid index.
    :type i:  1d array or list of int.
    :returns: The coordinate of grid point i.
    :rtype:   1d numpy array of float.


Find the grid point nearest to a given position.

    :param p: Coordinate.
    :type p:  1d numpy array or list of float
    :returns: grid index of nearest point.
    :rtype:   tuple of int


    :returns: Number of grid points in each dimension.
    :rtype:   1d numpy array of int


    :returns: Number of ghost zones in each dimension.
    :rtype:   1d numpy array of int


Position of the corner with maximum coordinates (cell center).

    :returns: Corner coordinate.
    :rtype:   1d numpy array of float


Position of the corner with minimum coordinates (cell center).

    :returns: Corner coordinate.
    :rtype:   1d numpy array of float


    :returns: Grid spacing.
    :rtype:   1d numpy array of float


    :returns: Volume of a grid cell.
    :rtype:   float


    :returns: Volume of the whole grid.
    :rtype:   float


Refinement level if this grid belongs to a hierachy, else -1.

    :returns: Level.
    :rtype:   int


Component number if this grid belongs to a hierachy, else -1.

    :returns: Component number.
    :rtype:   int


Test if a coordinate is contained in the grid. The size of the
    grid cells is taken into account, resulting in a cube larger by
    dx/2 on each side compared to the one given by x0, x1.

    :param pos: Coordinate to test.
    :type pos:  1d numpy array or list of float.
    :returns:   If pos is contained.
    :rtype:     bool


Get coordinates of the grid points as 1D arrays.

    :returns: The coordinate array of each dimension.
    :rtype:   list of 1d numpy arrays


Get coordinates of the grid points as 2D arrays with the same
    shape as the grid. Useful for arithmetic computations involving
    both data and coordinates.

    :returns: The coordinate array of each dimension.
    :rtype:   list of numpy arrays with same shape as grid.


Compute bounding box of regular grids.

  :param geoms: list of grid geometries.
  :type geoms:  list of :py:class:`~.RegGeom`
  :returns: the common bounding box of a list of geometries
  :rtype: tuple of coordinates


Compute a regular grid covering the bounding box of a list of grid
  geometries, with the same grid spacing. All geometries must belong to
  the same refinement level.

  :param geoms: list of grid geometries.
  :type geoms:  list of :py:class:`~.RegGeom`
  :returns: Grid geometry covering all input grids.
  :rtype: :py:class:`~.RegGeom`


    :param axis:  optional, compute max along single axis
    :type axis:   int or None
    :returns:     Maximum value over all points on the grid if axis=None,
                  else RegData containing max along given axis.
    :rtype:       float (or complex if data is complex).


    :param axis:  optional, compute min along single axis
    :type axis:   int or None
    :returns:     Minimum value over all points on the grid if axis=None,
                  else RegData containing min along given axis.
    :rtype:       float (or complex if data is complex).


Compute the integral over the whole volume of the grid.

    :returns: The integral.
    :rtype:   float (or complex if data is complex).


    :param axis:  optional, compute mean along single axis
    :type axis:   int or None
    :returns:     Mean value over all points on the grid if axis=None,
                  else RegData containing mean along given axis.
    :rtype:       float (or complex if data is complex).


1D Histogram of the data.
    :param weights:    the weight for each cell. Default is one.
    :type weights:     RegData or numpy array of same shape or None.
    :param vmin:       Lower bound of data to consider. Default is data range.
    :type vmin:        float or None
    :param vmax:       Upper bound of data to consider. Default is data range.
    :type vmax:        float or None
    :param nbins:      Number of bins to create.
    :type nbins:       integer > 1

    :returns: the positions of the data bins and the distribution.
    :rtype:   tuple of two 1D numpy arrays.


Find values for which a given fraction(s) of the data is smaller.

    Optionally, the cells can have an optional weight, and absolute counts
    can be used insted of fraction.

    :param fractions: list of fraction/absolute values
    :type fractions:  list or array of floats
    :param weights:    the weight for each cell. Default is one.
    :type weights:     RegData or numpy array of same shape or None.
    :param relative:   whether fractions refer to relative or absolute count.
    :type relative:    bool
    :param vmin:       Lower bound of data to consider. Default is data range.
    :type vmin:        float or None
    :param vmax:       Upper bound of data to consider. Default is data range.
    :type vmax:        float or None
    :param nbins:      Number of bins to create.
    :type nbins:       integer > 1

    :returns: data values corresponding to the given fractions.
    :rtype:   1D numpy array


Computes the partial derivative along a given dimension. Uses
    either a 3-point central difference stencil for 2nd order accuracy,
    or a five point central stencil for 4th order. At the boundaries, 1
    point (2 for 4th order) is computed to first order accuracy using
    one-sided derivatives. The array size in the dimension dim needs to
    be at least the stencil size.

    :param dim:   Dimension of partial derivative.
    :type dim:    int
    :param order: Order of accuracy (2 or 4).
    :type order:  int
    :returns:     The derivative.
    :rtype:       :py:class:`~.RegData` instance


Compute the gradient. See diff for details.

    :param order: Order of accuracy (2 or 4).
    :type order:  int
    :returns:     The gradient vector.
    :rtype:       :py:class:`~.Vec` instance.


Zeroth order interpolation. For positions outside the grid, it
    uses the outside value specified when creating the object.

    :param i: Position in terms of real valued grid index (not
              a coordinate!)
    :type i:  1d numpy array or list of float
    :returns: Value at nearest grid point or outside_value.
    :rtype:   same as data.


Zeroth order interpolation. For positions outside the grid, it
    uses the outside value specified when creating the object.

    :param x: Coordinate to interpolate to.
    :type x:  1d numpy array or list of float
    :returns: Value at nearest grid point or outside_value.
    :rtype:   same as data.


Perform a multilinear interpolation to the coordinate x. If x
    is outside the grid, return the outside value.

    :param x: Coordinate to interpolate to.
    :type x:  1d numpy array or list of float
    :returns: Value at nearest grid point or outside_value.
    :rtype:   same as data.


Returns interpolating spline that represents the data
    as a function. Always use this instead of calling sample_generic()
    repeatedly, because computing the spline coefficients is
    expensive.

    :param order: Order of the spline, must be in [2,5]. Default is 3.
    :type order:  Int
    :param mode:  How to treat values outside the data range.
    :type mode:   'constant', 'nearest', 'reflect' or 'wrap'


Interpolate the data to arbitrary (irregular) coordinates.
    Coordinates outside the grid are treated according to the mode
    parameter, where 'constant' means use the outside value, 'nearest'
    means zero-order extrapolation. Do not use this method repeatedly,
    instead use the spline() method which is then more efficient.

    :param coords:  List of coordinate arrays for each dimension.
    :type coords:   list of numpy arrays
    :param order:   Order of the spline, must be in [2,5]. Default is 3.
    :type order:    Int
    :param mode:    How to treat values outside the data range.
    :type mode:     'constant', 'nearest', 'reflect' or 'wrap'
    :returns:       Interpolated data.
    :rtype:         numpy array with same dimension as the coordinate
                    arrays


Resample the data to a regular grid geometry specified.
    Coordinates outside the grid are treated according to the mode
    parameter, where 'constant' means use the outside value, 'nearest'
    means zero-order extrapolation. Can create new data for results or
    overwrite a given dataset (for efficiency).

    :param order:   Interpolation order.
    :type order:    int
    :param output:  If not None, where to write results to.
    :type output:   None or numpy array
    :param mode:    How to treat outside positions.
    :type mode:     string
    :returns:       Interpolated data.
    :rtype:         :py:class:`~.RegData` or None


Replace data in the intersection with another object by resampled data
    from the other object. Ghost zones in the other object are excluded from
    the intersection, but used during the interpolation.


Fill points assuming reflection symmetry along given axis.


Get coordinates as regular datasets. Useful for arithmetic
    operations involving data and coordinates.

    :returns: list of coordinates for each dimension
    :rtype:   list of :py:class:`~.RegData` instances


Apply a unary function to the data.

    :param op: unary function.
    :type op:  function operating on a numpy array
    :returns:  result.
    :rtype:    :py:class:`~.RegData` instance.


Apply a binary function to two regular data sets.

    :param a:  Left operand.
    :type a:   :py:class:`~.RegData` or numpy array.
    :param b:  Right operand.
    :type b:   :py:class:`~.RegData` or numpy array.

    :param f:  binary function.
    :type f:   function operating on two numpy arrays
    :returns:  f(a,b).
    :rtype:    :py:class:`~.RegData` instance.


    :returns: absolute value.
    :rtype:   :py:class:`~.RegData`


    :returns: sign
    :rtype:   :py:class:`~.RegData`


    :returns: complex phase
    :rtype:   :py:class:`~.RegData`


    :returns: sine
    :rtype:   :py:class:`~.RegData`


    :returns: cosine
    :rtype:   :py:class:`~.RegData`


    :returns: tangens
    :rtype:   :py:class:`~.RegData`


    :returns: arc sine
    :rtype:   :py:class:`~.RegData`