        Returns whether the (closed) path contains the given point.

        If *transform* is not ``None``, the path will be transformed before
        performing the test.

        *radius* allows the path to be made slightly larger or smaller.


        Returns a bool array which is ``True`` if the (closed) path contains
        the corresponding point.

        If *transform* is not ``None``, the path will be transformed before
        performing the test.

        *radius* allows the path to be made slightly larger or smaller.


        Returns whether this (closed) path completely contains the given path.

        If *transform* is not ``None``, the path will be transformed before
        performing the test.


        Returns *True* if this path intersects another given path.

        *filled*, when True, treats the paths as if they were filled.
        That is, if one path completely encloses the other,
        :meth:`intersects_path` will return True.


        Return a :class:`Path` for a unit regular
        asterisk with the given numVertices and radius of 1.0,
        centered at (0, 0).


        Return the readonly :class:`Path` of the unit circle.

        For most cases, :func:`Path.circle` will be what you want.


        Return a wedge of the unit circle from angle
        *theta1* to angle *theta2* (in degrees).

        *theta2* is unwrapped to produce the shortest wedge within 360 degrees.
        That is, if *theta2* > *theta1* + 360, the wedge will be from *theta1*
        to *theta2* - 360 and not a full circle plus some extra overlap.

        If *n* is provided, it is the number of spline segments to make.
        If *n* is not provided, the number of spline segments is
        determined based on the delta between *theta1* and *theta2*.


        Clip the path to the given bounding box.

        The path must be made up of one or more closed polygons.  This
        algorithm will not behave correctly for unclosed paths.

        If *inside* is `True`, clip to the inside of the box, otherwise
        to the outside of the box.


Helper function to locate the legend


        Returns the patch used to draw the background of the axes.  It
        is also used as the clipping path for any data elements on the
        axes.

        In the standard axes, this is a rectangle, but in other
        projections it may not be.

        .. note::

            Intended to be overridden by new projection types.


        Return *True* if the given *mouseevent* (in display coords)
        is in the Axes


        When autoscaling, whether to obey all `Artist.sticky_edges`.

        Default is ``True``.

        Setting this to ``False`` ensures that the specified margins
        will be applied, even if the plot includes an image, for
        example, which would otherwise force a view limit to coincide
        with its data limit.

        The changing this property does not change the plot until
        `autoscale` or `autoscale_view` is called.


Return *True* if this axes supports the zoom box button functionality.


Return *True* if this axes supports any pan/zoom button functionality.


        Called when a pan operation completes (when the mouse button
        is up.)

        .. note::

            Intended to be overridden by new projection types.


        Returns *True* if the point (tuple of x,y) is inside the axes
        (the area defined by the its patch). A pixel coordinate is
        required.


        Performs the interpolation at points belonging to the triangulation
        (inside an unmasked triangles).

        Parameters
        ----------
        return_index : string key from {'z', 'dzdx', 'dzdy'}
            Identifies the requested values (z or its derivatives)
        tri_index : 1d integer array
            Valid triangle index (-1 prohibited)
        x, y : 1d arrays, same shape as `tri_index`
            Valid locations where interpolation is requested.

        Returns
        -------
        ret : 1-d array
            Returned array of the same size as *tri_index*


        Fast (vectorized) function to compute triangle jacobian matrix.

        Parameters
        ----------
        tris_pts : array like of dim 3 (shape: (nx,3,2))
                    Coordinates of the containing triangles apexes.

        Returns
        -------
        J : array of dim 3 (shape (nx,2,2))
                 Barycentric coordinates of the points inside the containing
                 triangles.
                 J[itri,:,:] is the jacobian matrix at apex 0 of the triangle
                 itri, so that the following (matrix) relationship holds:
                    [dz/dksi] = [J] x [dz/dx]
                    with x: global coordinates
                    ksi: element parametric coordinates in triangle first apex
                    local basis.


        Computes reduced-HCT elements degrees of freedom, knowing the
        gradient.


        self.df is computed as weighted average of _triangles sharing a common
        node. On each triangle itri f is first assumed linear (= ~f), which
        allows to compute d~f[itri]
        Then the following approximation of df nodal values is then proposed:
            f[ipt] = SUM ( w[itri] x d~f[itri] , for itri sharing apex ipt)
        The weighted coeff. w[itri] are proportional to the angle of the
        triangle itri at apex ipt


        Compute the (global) gradient component of f assumed linear (~f).
        returns array df of shape (nelems,2)
        df[ielem].dM[ielem] = dz[ielem] i.e. df = dz x dM = dM.T^-1 x dz


        Dot product of self by a vector *V* in sparse-dense to dense format
        *V* dense vector of shape (self.m,)


Compress rows, cols, vals / summing duplicates. Sort for csc format.


Compress rows, cols, vals / summing duplicates. Sort for csr format.


        Returns a dense matrix representing self.
        Mainly for debugging purposes.


Returns the (dense) vector of the diagonal elements.


Scalar product between scalars and matrices.


        Factors to rescale the triangulation into a unit square.

        Returns *k*, tuple of 2 scale factors.

        Returns
        -------
        k : tuple of 2 floats (kx, ky)
            Tuple of floats that would rescale the triangulation :
            ``[triangulation.x * kx, triangulation.y * ky]``
            fits exactly inside a unit square.


        Return a python list containing the statistics about the node tree:
            0: number of nodes (tree size)
            1: number of unique nodes
            2: number of trapezoids (tree leaf nodes)
            3: number of unique trapezoids
            4: maximum parent count (max number of times a node is repeated in
                   tree)
            5: maximum depth of tree (one more than the maximum number of
                   comparisons needed to search through the tree)
            6: mean of all trapezoid depths (one more than the average number
                   of comparisons needed to search through the tree)


        Initialize the underlying C++ object.  Can be called multiple times if,
        for example, the triangulation is modified.


        Print a text representation of the node tree, which is useful for
        debugging purposes.


        Calculate plane equation coefficients for all unmasked triangles from
        the point (x,y) coordinates and specified z-array of shape (npoints).
        Returned array has shape (npoints,3) and allows z-value at (x,y)
        position in triangle tri to be calculated using
        z = array[tri,0]*x + array[tri,1]*y + array[tri,2].


        Return integer array of shape (nedges,2) containing all edges of
        non-masked triangles.

        Each edge is the start point index and end point index.  Each
        edge (start,end and end,start) appears only once.


        Return integer array of shape (ntri,3) containing neighbor
        triangles.

        For each triangle, the indices of the three triangles that
        share the same edges, or -1 if there is no such neighboring
        triangle.  neighbors[i,j] is the triangle that is the neighbor
        to the edge from point index triangles[i,j] to point index
        triangles[i,(j+1)%3].


agg backend doesn't support arbitrary scaling of image.


        Restore the saved region. If bbox (instance of BboxBase, or
        its extents) is given, only the region specified by the bbox
        will be restored. *xy* (a tuple of two floasts) optionally
        specifies the new position (the LLC of the original region,
        not the LLC of the bbox) where the region will be restored.

        >>> region = renderer.copy_from_bbox()
        >>> x1, y1, x2, y2 = region.get_extents()
        >>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2),
        ...                         xy=(x1-dx, y1))


Start filtering. It simply create a new canvas (the old one is saved).


Get the image as an ARGB byte string

        `draw` must be called at least once before this function will work and
        to update the renderer for any subsequent changes to the Figure.

        Returns
        -------
        bytes


Get the image as an RGBA byte string

        `draw` must be called at least once before this function will work and
        to update the renderer for any subsequent changes to the Figure.

        Returns
        -------
        bytes


Select the current bitmap into this wxDC instance


Select a Null bitmasp into this wxDC instance


control wx mouse capture


A special method to re-show the figure in the notebook.


            Generate a list of n random ports near the given port.

            The first 5 ports will be sequential, and the remaining n-5 will be
            randomly selected in the range [port-2*n, port+2*n].


Draw the figure using the renderer


Write some data on the stream.


Flush the compression object.


Flush all buffers and free all resources.


Return name of a marker XObject representing the given path.


        Predicate: does the path need to be stroked (its outline drawn)?
        This tests for the various conditions that disable stroking
        the path, in which case it would presumably be filled.


        Predicate: does the path need to be filled?

        An optional argument can be used to specify an alternative
        _fillcolor, as needed by RendererPdf.draw_markers.


        Return the appropriate pdf operator to cause the path to be
        stroked, filled, or both.


Set clip rectangle. Calls self.pop() and self.push().


Make sure every pushed graphics state is popped.


    Determine if a wedge (in degrees) spans the full circle.

    The condition is derived from :class:`~matplotlib.patches.Wedge`.


    Determine if a wedge (in radians) spans the full circle.

    The condition is derived from :class:`~matplotlib.patches.Wedge`.


        Return *True* if this axes supports the zoom box button functionality.

        Polar axes do not support zoom boxes.


        Return *True* if this axes supports the pan/zoom button functionality.

        For polar axes, this is slightly misleading. Both panning and
        zooming are performed by the same button. Panning is performed
        in azimuth while zooming is done along the radial.


Register a new set of projection(s).


        Return *True* if this axes supports the zoom box button functionality.

        This axes object does not support interactive zoom box.


    Returns `True` if the given writable file-like object requires Unicode
    to be written to it.


Get the topmost artist of a list.

    In case of a tie, return the *last* of the tied artists, as it will be
    drawn on top of the others. `max` returns the first maximum in case of ties
    (on Py2 this is undocumented but true), so we need to iterate over the list
    in reverse order.


Convert a PathPatch to a PathPatch3D object.


    Reorder coordinates so that 2D xs, ys can be plotted in the plane
    orthogonal to zdir. zdir is normally x, y or z. However, if zdir
    starts with a '-' it is interpreted as a compensation for rotate_axes.


        For artists in an axes, if the zaxis has units support,
        convert *z* using zaxis unit type

        .. versionadded :: 1.2.1


        Return *True* if this axes supports the zoom box button functionality.

        3D axes objects do not use the zoom box button.


        Return *True* if this axes supports the pan/zoom button functionality.

        3D axes objects do not use the pan/zoom button.


        Invert the z-axis.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.


Generator of cyclic permutation matices


        Toggle visibility of ticks, ticklabels, and (axis) label.
        To turn all off, ::

          axis.toggle(all=False)

        To turn all off but ticks on ::

          axis.toggle(all=False, ticks=True)

        To turn all on but (axis) label off ::

          axis.toggle(all=True, label=False))


Turn seed into a np.random.RandomState instance

    If seed is None (or np.random), return the RandomState singleton used
    by np.random.
    If seed is an int, return a new RandomState instance seeded with seed.
    If seed is already a RandomState instance, return it.
    Otherwise raise ValueError.


Helper function to vectorize functions on array inputs


Ensure a directory exists. Create it if not


    Download file from url, and save to outfilename
    :param url:
    :param outfilename:
    :return:


    The following function determines what the operating system is,
      and which fortran compiler to use for compiling lnfl and lblrtm.
      It returns the string that the makefiles for lnfl and lblrtm
      need.

      NOTE: This should all work for linux or Mac OSX, but NOT Windows!!


    only for user with gfortran compiler
    If gfortran version is later than v7.5.0, we need to add -std=legacy while compile the fortran code


    The following will generate a TAPE3, which is needed for LBLRTM.
     The directory of the lnfl executable must be given.


    The following is called by build. It does the following things
    1) Gets the lblrtm files from server
    2) Unpacks all the lblrtm tar-files
    3) Builds the lblrtm and lnfl executables using their makefiles
        Note: the fortran compiler is determined above
    4) Generates a TAPE3 using LNFL, which LBLRTM needs as a static input
    5) Generates rundirs in the current directory, and populates them
        with the necessary files
    6) Outputs the bash commands that need to be run in order to setup
        the correct environment variables, and offers to append these
        to the user's ~/.bashrc


        Turns the data structure into a multidimensional np array
        If norm == True, it will have shape self.size(), 2 and the y
          axis will be divided by the continuum axis
        Otherwise, it will have shape self.size(), 4


        Strips units from an xypoint structure.

        Returns:
          A copy of the xypoint with no units
          The x-units
          the y-units


    Function to combine a list of xypoints into a single
      xypoint. Useful for combining several orders/chips
      or for coadding spectra

    Warning! This function is basically un-tested! It is NOT used
    in TelFit!

      ***Optional keywords***
      snr: the spectra will be weighted by the signal-to-noise ratio
           before adding
      xspacing: the x-spacing in the final array
      numpoints: the number of points in the final array. If neither
                 numpoints nor xspacing is given, the x-spacing in the
                 final array will be determined by averaging the spacing
                 in each of the xypoints.
      interp_order: the interpolation order. Default is cubic


        Display the value of each of the parameters, and show whether it is being fit or not

        :param fitonly: bool variable. If true, it only shows the variables being fit. Otherwise,
                        it shows all variables.

        :return: None


        Add one or more variables to the list being fit.

        :param vardict: a dictionary where the key is the parameter
                     name and the value is the initial guess for that parameter.
                     Valid parameter names can be found by invoking
                     DisplayVariables(fitonly=False)

        :return: None


        Adjust the value of a constant parameter. This is useful for something like
        setting the pressure or the telescope zenith distance, which will be known very
        well and is important to getting a good fit, but does not need to be varied.

        Warning: The variable will be removed from the list of variables to fit, so
        DO NOT use this to adjust the value of a parameter you want TelFit to adjust!

        :param vardict: a dictionary where the key is the parameter
                        name and the value is the value of that parameter.
                        Valid parameter names can be found by invoking
                        DisplayVariables(fitonly=False)

        :return: None


        Returns the value of the variable given.
        Useful to get the fitted value of the parameters


        Set bounds on one or more parameters.

        :param vardict: a dictionary where the key is the parameter
                     name and the value is a list of size 2 containing
                     the lower and upper bounds. You can provide one-sided
                     bounds using np.inf or -np.inf.
                     Valid parameter names can be found by invoking
                     DisplayVariables(fitonly=False)

        :return: None


        Set the observatory. Can either give a dictionary with the latitude and altitude,
          or give the name of the observatory. Some names are hard-coded in here.


        Function for the user to give the data. The data should be in the form of
          a DataStructures.xypoint structure, and the x-units must either be an
          instance of astropy.quantities.Quantity or in nanometers.


        Edits the atmosphere profile for a given parameter. This is just a wrapper
        for the MakeModel.Modeler method, but the docstring is replicated below:

        :param profilename: A string with the name of the profile to edit.
                       Should be either 'pressure', 'temperature', or
                       one of the molecules given in the MakeModel.MoleculeNumbers
                       dictionary
        :param profile_height: A np array with the height in the atmosphere (in km)
        :param profile_value: A np array with the value of the profile parameter at
                              each height given in profile_height.

        :return: None


        Tells the fitter to ignore certain regions of the spectrum
          in the chi-squared calculation. Useful for stellar or interstellar
          lines.

        :param region:  Can be either a list of size 2 with the beginning and ending
                  wavelength range to ignore, or a list of lists giving several
                  wavelength ranges at once.


        The main fitting function. Before calling this, the user MUST

           1 call FitVariable at least once, specifying which variables will be fit
           2 Set resolution bounds (any other bounds are optional)

        :param data: If given, this should be a DataStructures.xypoint instance
                     giving the data you wish to fit. The units of the .x attribute MUST be nanometers!
        :param resolution_fit_mode: controls which function is used to estimate the resolution.
                                    "SVD" is for singlular value decomposition, while "gauss"
                                    is for convolving with a gaussian (and fitting the width
                                    of the guassian to give the best fit). I have found the 'gauss'
                                    is best when the telluric lines are pretty weak, such as in much
                                    of the optical spectrum. For strong telluric lines, SVD is both
                                    faster and more accurate.
        :param fit_primary: Deprecated. See fit_source
        :param return_resolution:  controls whether the best-fit resolution is returned to the user.
                                   One case I have used this for is to fit echelle data of late-type
                                   stars by getting all the best-fit parameters from redder orders,
                                   and then applying those atmospheric parameters to the rest of the
                                   orders.
        :param adjust_wave:     Can be set to either 'data' or 'model'. To wavelength calibrate the
                                data to the telluric lines, set to 'data'. If you think the wavelength
                                calibration is good on the data (such as Th-Ar lines in the optical),
                                then set to 'model' Note that currently, the vacuum --> air conversion
                                for the telluric model is done in a very approximate sense, so
                                adjusting the data wavelengths may introduce a small (few km/s) offset
                                from what it should be. That is fine for relative RVs, but probably not
                                for absolute RVs.
        :param continuum_fit_order:  The polynomial order with which to fit the continuum. It uses a
                                     sigma-clipping algorithm so that the continuum is not strongly
                                     affected by stellar lines (either absorption or emission)
        :param wavelength_fit_order: The polynomial order with which to adjust the wavelength fit. Note
                                     that the 'adjust_wave' input will determine whether the data or the
                                     telluric model is wavelength-adjusted.
        :param air_wave:  Are the wavelengths in air wavelengths? Default is True.
        :param fit_source:  determines whether an attempt to fit the source spectrum (the spectrum of the
                            object you are fitting, not the telluric lines) is made. If true, this function
                            returns both the best-fit model and the source estimate. By default, it fits
                            the source spectrum with a simple smoothing kernel that works well for rapidly
                            rotating stars. However, you can give a custom source fitting function with the
                            'source_fcn' keyword.
        :param source_fcn:  A function that takes a DataStructures.xypoint instance and any number of
                            arguments/keyword arguments after it. This function should expect a spectrum of
                            the source (without telluric lines) and attempt to fit it.
                            Warning: This function will be called in every iteration, so do not use a function
                            that takes more than ~1 second, or the telluric fit will slow down considerably!
        :param source_args: A list of arguments to give to the source function.
        :param source_kwargs: A dictionary of keyword arguments to give to the source function.

        :return: The best-fit telluric model, as a DataStructures.xypoint instance where the x-axis is
                 sampled the same as the data (so you should be able to directly divide the two). If
                 fit_source = True, this method also returns the estimate for the source spectrum *before*
                 the telluric model. If return_resolution is True, it also returns a float with the
                 best resolution fit. The return order is:
                 source_spec, model_spec, resolution


The error function for the fitter. This should never be called directly!


        This function does the actual work of generating a model with the given parameters,
        fitting the continuum, making sure the model and data are well aligned in
        wavelength, and fitting the detector resolution. In general, it is not meant to be
        called directly by the user. However, the 'nofit' keyword turns this into a wrapper
        to MakeModel.Modeler().MakeModel() with all the appropriate parameters.

        :param pars: A list of the parameters currently being fit (as given in self.FitVariable).
        :param nofit: If true, it will not perform a fit to the data and simply return the model.
        :param separate_source: If true, it will fit the source spectrum as a smoothed version of the residuals.
                                Useful for spectra with broad lines.
        :param return_resolution: If true, it will return the best-fit resolution.
        :param broaden: If true and nofit=True, it will broaden the returned model by the expected detector resolution.
                        Ignored if nofit=False
        :param model: A DataStructures.xypoint instance containing an un-broadened telluric model.
                      If given, it uses this instead of making one.
        :param air_wave: Set True of False to overwrite the air_wave saved under self. Default is None, which will use the self.air_wave attribute

        :return:  The best-fit telluric model, as a DataStructures.xypoint instance where the x-axis is
                 sampled the same as the data (so you should be able to directly divide the two). If
                 separate_source = True, this method also returns the estimate for the source spectrum *before*
                 the telluric model. If return_resolution is True, it also returns a float with the
                 best resolution fit. The return order is:
                 source_spec, model_spec, resolution


        Error function for the scipy.minimize fitters. Not meant to be
        called directly by the user!


        Generate a gaussian absorption line. Not meant to be called
        directly by the user!


        This function fits a gaussian to a line. The input
        should be a small segment (~0.1 nm or so), in an xypoint structure
        Not meant to be called directly by the user!


        Function to fine-tune the wavelength solution of a generated model
          It does so by looking for telluric lines in both the
          data and the telluric model. For each line, it finds the shift needed
          to make them line up, and then fits a function to that fit over the
          full wavelength range of the data. Wavelength calibration MUST already
          be very close for this algorithm to succeed! NOT MEANT TO BE CALLED
          DIRECTLY BY THE USER!


        Generates a polynomial with the given parameters
        for all of the x-values.
        x is assumed to be a np.ndarray!
         Not meant to be called directly by the user!


        Cost function for the new wavelength fitter.
        Not meant to be called directly by the user!


        This is a vastly simplified version of FitWavelength.
        It takes the same inputs and returns the same thing,
        so is a drop-in replacement for the old FitWavelength.

        Instead of finding the lines, and generating a polynomial
        to apply to the axis as x --> f(x), it fits a polynomial
        to the delta-x. So, it fits the function for x --> x + f(x).
        This way, we can automatically penalize large deviations in
        the wavelength.


        Fits the instrumental resolution with a Gaussian. This method is
        called by GenerateModel, and is not meant to be called by the user!


        This function gets called by scipy.optimize.fminbound in FitResolution.
        Not meant to be called directly by the user!


        Fits the broadening profile using singular value decomposition. This function is
        called by GenerateModel, and is not meant to be called directly!

        -oversampling is the oversampling factor to use before doing the SVD
        -m is the size of the broadening function, in oversampled units
        -dimension is the number of eigenvalues to keep in the broadening function. (Keeping too many starts fitting noise)

        -NOTE: This function works well when there are strong telluric lines and a flat continuum.
               If there are weak telluric lines, it's hard to not fit noise.
               If the continuum is not very flat (i.e. from the spectrum of the actual
                 object you are trying to telluric correct), the broadening function
                 can become multiply-peaked and oscillatory. Use with care!


        Finds the first zero-crossing of the array-like structure l

        :param l:
        :return: index of the zero crossing


Smooths the residuals after telluric division as an estimate of the star spectrum


        This function will take a np array as a profile, and stitch it into the
          MIPAS atmosphere profile read in in __init__

        :param profilename: A string with the name of the profile to edit.
                       Should be either 'pressure', 'temperature', or
                       one of the molecules given in the MakeModel.MoleculeNumbers
                       dictionary
        :param profile_height: A np array with the height in the atmosphere (in km)
        :param profile_value: A np array with the value of the profile parameter at
                              each height given in profile_height.
        :return: None


          Release the lock on the directory. This can be called on its own, but
          should never need to be.


        Find a run directory to work in. This is necessary so that you
          can run several instances of MakeModel (or TelFit) at once.
          Should not need to be called on directly by the user.


        Here is the important function! All of the variables have default values,
          which you will want to override for any realistic use.

        :param pressure:       Pressure at telescope altitude (hPa)
        :param temperature:    Temperature at telescope altitude (Kelvin)
        :param lowfreq:        The starting wavenumber (cm^-1)
        :param highfreq:       The ending wavenumber (cm^-1)
        :param angle:          The zenith distance of the telescope (degrees). This is related to
                               the airmass (z) through z = sec(angle)
        :param humidity:       Percent relative humidity at the telescope altitude.
        :param co2:            Mixing ratio of this molecule (parts per million by volumne)
        :param o3:             Mixing ratio of this molecule (parts per million by volumne)
        :param n2o:            Mixing ratio of this molecule (parts per million by volumne)
        :param co:             Mixing ratio of this molecule (parts per million by volumne)
        :param ch4:            Mixing ratio of this molecule (parts per million by volumne)
        :param o2:             Mixing ratio of this molecule (parts per million by volumne)
        :param no:             Mixing ratio of this molecule (parts per million by volumne)
        :param so2:            Mixing ratio of this molecule (parts per million by volumne)
        :param no2:            Mixing ratio of this molecule (parts per million by volumne)
        :param nh3:            Mixing ratio of this molecule (parts per million by volumne)
        :param hno3:           Mixing ratio of this molecule (parts per million by volumne)
        :param lat:            The latitude of the observatory (degrees)
        :param alt:            The altitude of the observatory above sea level (km)
        :param wavegrid:       If given, the model will be resampled to this grid.
                               Should be a 1D np array
        :param resolution:     If given, it will reduce the resolution by convolving
                               with a gaussian of appropriate width. Should be a float
                               with R=lam/dlam
        :param save:           If true, the generated model is saved. The filename will be
                               printed to the screen.
        :param libfile:        Useful if generating a telluric library. The filename of the
                               saved file will be written to this filename. Should be a string
                               variable. Ignored if save==False
        :param vac2air:        If True (default), it converts the wavelengths from vacuum to air

        :return:               DataStructures.xypoint instance with the telluric model. The x-axis
                               is in nanometers and the y-axis is in fractional transmission.


        Here is a function to read in the binary output of lblrtm, and convert
          it into arrays of frequency and transmission.
        Warning! Some values are hard-coded in for single precision calculations.
          You MUST compile lblrtm as single precision or this won't work!
        Not meant to be called directly by the user.


      This function uses equations and constants from
      http://www.vaisala.com/Vaisala%20Documents/Application%20notes/Humidity_Conversion_Formulas_B210973EN-F.pdf
      to determine the vapor pressure at the given temperature

      T must be a float with the temperature (or dew point) in Kelvin


Given the relative humidity, temperature, and pressure, return the ppmv water concentration


Given the ppmv water concentration, temperature, and pressure, return the relative humidity


      Loop over the lines. The type of profile is denoted by lines
        that start with a '*'


      This function reads in the GDAS profile, sorts the data
        by the atmosphere height, and converts the values
        to the appropriate units
      Returns: pressure, height, temperature, and relative humidity
               at several layers, interpolated to the observation time


    Function to output a fits file
    column_dict is a dictionary where the key is the name of the column
       and the value is a numpy array with the data. Example of a column
       would be the wavelength or flux at each pixel
    template is the filename of the template fits file. The header will
       be taken from this file and used as the main header
    mode determines how the outputted file is made. Append will just add
       a fits extension to the existing file (and then save it as outfilename)
       "new" mode will create a new fits file.
       header_info takes a list of lists. Each sub-list should have size 2 where the first element is the name of the new keyword, and the second element is the corresponding value. A 3rd element may be added as a comment


    this function attempts to import any version of dnppy. If it finds
    the user does not already have a version of 1.15.3b0 or greater, it
    downloads "_logo.png" from the release assets. These downloads are
    tracked and help us to establish the real size of dnppy's user base

    returns True if new user.


removes numpy 1.7 by deleting the folder from site packages


    raises an exception if processes which may lock dependencies from being
    upgraded are presently running


returns true if module of input version can be imported


    setup commonly had to be run twice to succeed, the reason wasn't determined,
    as an immediate hack fix, each of these functions is simply called twice


        Central function for managing saving of intermediate data products

        depending on the value of self.saveflag, it will compare the input
        variable "flag_name" to a list of objects for which to save outputs.
        if the input object name is found in that list of variables to save,
        this function returns True, otherwise returns False.


        Primary functin for loading data into the main metric workspace.
        useful for arcpy tool creation

        landsat_filepath_list:  list of landsat band tiff filepaths, MUST be in order [2,3,4,5,6,7,10,11]
        landsat_metapath:       filepath to the landsat metadata
        dem_path:               filepath to the digital elevation model
        hot_shape_path:         filepath to the shapefile outlining the hot pixels
        cold_shape_path:        filepath to the shapefile outlining the cold pixels
        wx_data_path:           filepath to the weather data from NCDC data portal


        Ingests landsat data into the METRIC model by creating object attributes

        The list of filepaths in band_filepahts MUST contain filepaths to each
        of the following bands in ascending order. [2,3,4,5,6,7,10,11].


ingests the DEM into the metric model workspace. Jeff Ely


ingests the reference pixels into the metric model workspace


ingests the weather data file


@param nbe: found in get_narrow_band_emissivity (Ln262)


TIME ZONE OFFSET VALUE!!!


    main function for calling and executing the metric model

    workspace:              fresh folder to populate with the many metric model files and parameters
    saveflag:               parameter string to regulate intermediate output file generation
                                possible values include "ALL" , "LIMITED", "ET_ONLY"
    landsat_filepath_list:  list of landsat band tiff filepaths, MUST be in order [2,3,4,5,6,7,10,11]
    landsat_metapath:       filepath to the landsat metadata
    dem_path:               filepath to the digital elevation model
    hot_shape_path:         filepath to the shapefile outlining the hot pixels
    cold_shape_path:        filepath to the shapefile outlining the cold pixels
    wx_filepath:            filepath to the weather data. downloaded by following NDCD download tutorial
    recalc:                 forces all calculations to be reperformed
    crop:                   reference crop type, either "alfalfa" or "corn"
    timezone:               hour offset from GMT (usually an integer, -5 or -4 for the east coast USA)
    wx_elev                 the elevation of the weather station used
    wx_zom                  estimate of the "zom" term at weather station (temporary)
    LE_cold_cal_factor      used to calibrate LE terms. This should probably always be = 1.05


prints heads up stats for some variable, either raster or scalar


Run tool sourcecode by calling metric.py


    This function was writen to reenstate wx file parsing for tha greed upon NOAA
    weather data format for any study area within the USA. This is THE function
    that should be used for reading weather data, the others will not be supported.

    It expects data in the format as retrieved from this URL:
        [http://gis.ncdc.noaa.gov/map/viewer/#app=cdo&cfg=cdo&theme=hourly&layers=1&node=gi]

    Please see the readme for more detailed instructions on data download.

    Inputs:
        time_obj    A datetime object representing the image data aquisition datetime
        wx_path     filepath to the weather data. (hourly data)

    Returns:
        an array with specific ordering of climate variables.

    Author: Jeffry Ely


converts fmt strings to unit names of associated datetime attributes


converts unit names to fmt strings used by datetime.stftime. internal use


special case of "extract_column" method for time domain. internal use


returns datetime obj that is centered on the "unit" of the input datetime obj


converts seconds to other time units. internal use only


        creates the time_series data from a csv.

        This simply wraps the read_csv_rows function in csv_io module.


simply write the data to a csv file


builds columnwise data matrix with an actual dict


Removes rows where the specified column has an invalid number


simply adds a row to the time_series data


reconstructs the time series from its constituent subsets


merges two columns together (string concatenation)


        Converts time strings into time objects for standardized processing

        for tips on how to use 'fmt' variable, see url below:
        https://docs.python.org/2/library/datetime.html#strftime-strptime-behavior

        time header variable can be either the header string, or a column index num

        Creates two things:
            a converted list of time objects
            a new list of monotonically increasing decimal days


reorders the data in this time_series to be in ascending order by time


        splits the time series into individual time chunks

        used for taking advanced statistics, usually periodic
        in nature. Also usefull for exploiting temporal relationships
        in a dataset for a variety of purposes including data
        sanitation, periodic curve fitting, etc.

        fmt_units follows convention of fmt. For example:
        %Y  groups files by year
        %m  groups files by month
        %j  groups file by julian day of year

        the "overlap_width" variable can be set to greater than 0
        to allow "window" type statistics, so each subset may contain
        data points from adjacent subsets.

        overlap_width = 1 is like a window size of 3
        overlap_width = 2 is like a window size of 5

        WARNING: this function is imperfect for discretizing by months.
        the possible lengths of a month are extremely variant, so sometimes
        data points at the ends of a month will get placed in the adjacent
        month. If you absolutely require accurate month discretization,
        you should use this function to discretize by year, then use the
        "group_bins" function to bin each year by month. so,

        instead of
            ts.discretize("%Y")
            ts.discretize("%b")

        use
            ts.discretize("%Y")
            ts.group_bins("%b")

        Allows a custom center time to be used! This was added so that
        days could be centered around a specific daily aquisition time.
        for example, its often usefull to define a day as
        satellite data aquisition time +/- 12 hours.
        if used, "cust_center_time" must be a datetime object!


        sorts the time series into time chunks by common bin_unit

        used for grouping data rows together. For example, if one used
        this function on a 5 year dataset with a bin_unit of month,
        then the time_series would be subseted into 12 sets (1 for each
        month), which each set containing all entries for that month,
        regardless of what year they occurred in.

        fmt_units follows convention of fmt. For example:
        %Y  groups files by year
        %m  groups files by month
        %j  groups file by julian day of year

        similarly to "discretize" the "overlap_width" variable can be
        set to greater than 1 to allow "window" type statistics, so
        each subset may contain data points from adjacent subsets.
        However, for group_bins, overlap_width must be an integer.

        "cyclical" of "True" will allow end points to be considered adjacent.
        So, for example, January will be considered adjacent to December,
        day 1 will be considered adjacent to day 365.


        takes statistics on a specific column of data

        creates object attributes according to the column name


plots a specific column


used to normalize specific columns in the time series


Adds a monotonically increasing time column with units of decimal days


prints a heads up stats table of all subsets in this time_series


loads up a list of filepaths as a time series


        wraper for the "many_stats" function in the raster module

        performs the many_stats function on each of the lowest level
        subsets of this time_series object


    import csv data as standard rows

    It allows some custom spec_format flags to be used for very special
    case datasets:

    spec_format:
        DS3505
            data downloaded from the following website has a peculiarity
            [http://gis.ncdc.noaa.gov/map/viewer/#app=cdo&cfg=cdo&theme=hourly&layers=1&node=gi]
            in that it has some upercase T's that are rarely needed, but ruin otherwise
            uniform space formatting.


import csv data in columnwise format (transposed)


writes some row wise data structure to a csv file


writes some column wise data structure to a csv file


    Parses the xml format landsat metadata "MTL.txt" file

    This function parses the xml format metadata file associated with landsat images.
    it outputs a class instance metadata object with all the attributes found in the MTL
    file for quick referencing by other landsat related functions.

    Custom additions to metadata:
        datetime_obj    a datetime object for the precise date and time of image
                        aquisition (in Z time!)

    Inputs:
       filename    the filepath to a landsat MTL file.

    Returns:
        meta        class object with all metadata attributes


stitches constituent chunks back together into one numpy array


loads a raster image and splits it into roughly equal width vertical slices


writes the chunk_bundle to its rasterpath


        places a chunk into the chunk bundle.

        If chunk with that ID already exists, it will be replaced.


    Simple function to sort files into folders based on common leading
    strings in the filenames

    use a custom delimiter by setting "delim", and set "recursive" to True
    if you need to do many directories deep and do not mind renaming files


returns number of lines for input filename


this function has been absorbed into dnppy


This function uses the LTK algorithm to classify cloud
    cover in a Landsat 7 image using spectral bands 1, 3, 4, and 5.
    The Output image will have binary cell values.  0=cloud, 1= noncloud

    INPUTS----------------

    L7bands: A list of paths to GeoTIFF files containing individual bands of
             Landsat imagery. The order of these bands must be 1 - 3 - 4 - 5.
             These images may have pixel values that correspond to TOA Reflectance
             or Digital Numbers.If Digital Numbers are provided, then the bands
             must have the original filenames as downloaded from the USGS

    pixelvalue: Specify whether the pixel values of L7bands represent Reflectance or Digital Numbers

    OutputPath: Destination of the final output cloud mask. This mask must have either the .img or .tif extension

    MetaData: If the pixelvalue is Digital Numbers, this parameter is required for the conversion to TOA reflectance

    SaveRefl: Indicate whethere or not the intermediate reflectance values (if calculated) are saved to disk
                Default value is False

    ReflOutputFolder: If SaveRefl is True, this parameter indicates where to save Reflectance images.
                        If SaveRelf is True and this parameter is not provided, the Reflectance images
                        will be save in the containing folder of the OutputPath

    OUTPUTS----------------

    The path to a cloud mask for the input image. 0=cloud, 1= noncloud


This function is used to convert Landsat 4,5, or 7 pixel values from
    digital numbers to Radiance, Reflectance, or Temperature (if using Band 6)

    -----Inputs------
    Lbands: GeoTIFF files containing individual bands of Landsat imagery. These
    must have the original names as downloaded and must be from a single scene.

    MetaData: The metadata text file that is downloaded with the Landsat Bands themselves.
    This may be either the old or new MTL.txt file.

    OutputType: Choose whether the output should be:
                "Radiance"
                "Reflectance/Temperature" - Calculates Reflectance for spectral bands
                                            and Temperature in Kelvin for Thermal bands

    Save: Boolean value that indicates whether the output rasters will be saved permanantly
            Each band will be saved as an individual GeoTIFF file and be named
            accoriding to the original filename and the output pixel unit

            *if this is true, then the OutputFolder variable must also be set

    OutputFolder: Folder in which to save the output rasters

    -----Outputs-----

    A list of arcpy raster objects in a sequence that mirrors that of the input Lbands


    calculates the surface temperature with a modified plank equation
    following Markham and Barker.

                       K2
    Ts =    ----------------------
            ln((enb * K1 / Rc) +1)

    where
        K1  = constant 1, landsat specific
        K2  = constant 2, landsat specific
        Rc  = corrected thermal radiance
        enb = narrow band emissivity for thermal sensor wavelength band

    and

                Lt6 - Rp (tnb)
        Rc =    --------------  - (1 - enb) * Rsky
                     tnb

    where
        Lt6 = spectral radience of landsat band 6
        Rp  = path radiance in the 10.4 to 12.5 um band
        Rsky= narrow band downward thermal radiation from clear sky
        tnb = narrow band transmissivity of air (10.4 to 12.5 um range)


This function uses the Automated Cloud Cover Assessment algorithm to classify cloud
    cover in a Landsat 7 image using spectral bands 2,3,4, and 5 and thermal band 6.
    The Output image will have binary cell values.  0=cloud, 1= noncloud

    INPUTS----------------

    L7bands: A list of paths to GeoTIFF files containing individual bands of
             Landsat imagery. The order of these bands must be 2 - 3 - 4 - 5 - 6.
             These images may have pixel values that correspond to TOA Reflectance
             or Digital Numbers.If Digital Numbers are provided, then the bands
             must have the original filenames as downloaded from the USGS

    pixelvalue: Specify whether the pixel values of L7bands represent Reflectance or Digital Numbers

    OutputPath: Destination of the final output cloud mask. This mask must have either the .img or .tif extension

    MetaData: If the pixelvalue is Digital Numbers, this parameter is required for the conversion to TOA reflectance

    SaveRefl: Indicate whethere or not the intermediate reflectance values (if calculated) are saved to disk
                Default value is False

    ReflOutputFolder: If SaveRefl is True, this parameter indicates where to save Reflectance images.
                        If SaveRelf is True and this parameter is not provided, the Reflectance images
                        will be save in the containing folder of the OutputPath

    Filter5Thresh: This threshold will affect the aggressiveness of the cloud classification.
                    Higher-more aggressive
                    Lower -less aggressive

    Filter6Thresh: This threshold will affect the aggressiveness of the cloud classification.
                    Higher-more aggressive
                    Lower -less aggressive

    OUTPUTS----------------

    The path to a cloud mask for the input image. 0=cloud, 1= noncloud


Uses cloud masks for three seperate scenes to fill gaps in data
    due to SLC-induced gaps and clouds


    Quick script to perform mass unzipping on code packages collected
    for inclusion in proj_code.


        sets the critical time information including absolute julian day/century.
        Accepts datetime objects or a datetime string with format

        :param date_time_obj:   datetime object for time of solar calculations. Will also
                                accept string input with matching value for "fmt" param
        :param fmt:             if date_time_obj is input as a string, fmt allows it to be
                                interpreted
        :param GMT_hour_offset: Number of hours from GMT for timezone of calculation area.


prints attribute list and corresponding values


        Computes and prints all the attributes of this solar object. Spatial
        averages are printed for numpy array type attributes.


    Fetch WELD data from the server at [http://e4ftl01.cr.usgs.gov/WELD].
    Weld data is corrected and processed Landsat 5 and 7 data that is distributed in the
    MODIS sinusoidal projection and grid format. Read more about WELD data.
    https://landsat.usgs.gov/WELD.php
    http://globalmonitoring.sdstate.edu/projects/weldglobal/

    :param product:     WELD product to download such as 'USWK','USMO','USYR'
    :param tiles:       list of tiles to grab such as ['h11v12','h11v11']
    :param years:       list of years to grab such as range(2001,2014)
    :param outdir:      output directory to save downloaded files

    :return output_filelist: A list of full filepaths to files fetched be this function


    Fetches 30 minute resolution GPM IMERG data from an ftp server. Several restrictions exist
    for this relatively new dataset, please read in the input section carefully.

       http://pps.gsfc.nasa.gov/Documents/GPM_Data_Info_140616.pdf

    :param start_dto:   datetime object for starting time of study boundary
    :param end_dto:     datetime object for ending time of study boundary
    :param outdir:      output directory to save the data
    :param product:     either "early" , "late" or "final" for full HDF5 data stacks of the respective runs,
                        which are all at 30minute resolutions. OR product can be set equal to "gis"
                        (default) to find only tif averages of the precipitation estimates. This gis
                        tif data is ONLY provided for data less than one year old.
    :param time_res:    if "product"  is set to "gis", specify what time average period you want.
                        options are "30min", "3hr", "1day", "3day", "7day". Defaults to "1day"

    :return:            Returns a list of filepaths to freshly downloaded files

    learn more at [http://pmm.nasa.gov/data-access/downloads/gpm]


    Download a single file. input source url and output filename

    :param url:             a string url to file for download
    :param outname:         filepath to write location of file
    :param username:        use if url leads to file on ftp server with username
    :param password:        use if url leads to file on ftp server with password
    :param force_overwrite: by default, this function will not overwrite existing files
                            on drive. This is to avoid accidental overwrite of critical
                            files as well as repeated download of the same files.

    :return outname:    returns filepath to locally created file after download


    Downloads a list of files. Retries failed downloads

    This script downloads a list of files and places it in the output directory. It was
    built to be nested within "Download_filelist" to allow loops to continuously retry
    failed files until they are successful or a retry limit is reached.

    :param url_list:   array of urls, probably as read from a text file
    :param file_types: list of file types to download. Useful for excluding extraneous
                       metadata by only downloading 'hdf' or 'tif' for example. Please note
                       that often times, you actually NEED the metadata.
    :param outdir:     folder where files are to be placed after download

    :return failed:    list of files which failed download


    Lists contents of  http download site at [http://e4ftl01.cr.usgs.gov]
    which hosts select MODIS products, landsat WELD, and SRTM data.

    :param site: a url to somewhere on the server at http://e4ftl01.cr.usgs.gov

    :return file_urls: returns a list of urls to files on that http page.


    this function downloads SMAP data via FTP server

    no ftp server is presently public.


    functiong fetches VIIRS data via ftp server

    help: http://www.class.ncdc.noaa.gov/release/data_available/npp/npp_ftpserver.htm
    ftp:  ftp://ftp-npp.class.ngdc.noaa.gov/


    downloads data from the Shuttle Radar Topography Mission (SRTM)
    [http://e4ftl01.cr.usgs.gov/SRTM/]

    This data can be used to create DEMs of a variety of resolutions.

    :param ll_lat:      latitude of lower left corner
    :param ll_lon:      longitude of lower left corner
    :param ur_lat:      latitude of upper right corner
    :param ur_lon:      longitude of upper right corner
    :param product:     short name of product you want. See http://e4ftl01.cr.usgs.gov/SRTM/ .
                        do not include the version number. Example: "SRTMGL1". Note
                        that version "002" data of .DEM format does not support mosaicing.
    :param outdir:      local directory to save downloaded files
    :param mosaic:      Set to TRUE to mosaic all downloaded DEM tiles as "SRTM_mosaic.tif"

    :return tile_list:   a list of all successfully downloaded tif filepaths
                        for further manipulation

    NOTE: arcmap will open the output hgt files ONLY if they are not renamed.
    turns out arcmap does some funky things when interpreting these files.


    Lists contents of http directories at [http://water.weather.gov/precip/p_download_new/]
    which hosts MPE data.

    :param site: url to somewhere on the server at http://water.weather.gov/precip/p_download_new/

    :return file_urls: returns a list of file urls at input site.


    lists contents of typical FTP download site. returns two lists, the first is of
    filenames, the second is of full filepaths (including filenames) that one could
    patch through to the "download_url" function. returns False if the server has
    rejected our connection

    :param site:        url to ftp website root, does not need to include "ftp://"
    :param username:    username to log in with, if required
    :param password:    password to log in with, if required
    :param dir:         specific ftp directory we wish to access

    :returns filenames: a list of filenames
    :returns filepaths: a list of full filepaths


    Reads text file of download links, downloads them.

    This script reads a text file with urls such as those output from ECHO REVERB
    and outputs them to an output directory. It will retry failed links 20 times before
    giving up and outputting a warning to the user.

    :param ftp_texts:    array of txt files ordered from reverb containing ftp links
    :param file_type:    file extension of the desired files, leave blank or False to grab all types.
    :param outdir:       folder where files are to be placed after download

    :return list failed: list of files which failed to download after the end of the script.


    This function downloads all landsat 8 tiles for the input path_row_pairs and
    within the bounds of the start_dto and the end_dto, and saves them to the output directory.
    It uses the amazon web service at
    [https://aws.amazon.com/public-data-sets/landsat/]

    :param path_row_pairs:  tupled integer values of path,row coordinates of tile. may be a list of several                                 tuples. example: [(1,1),(1,2)]
    :param start_dto:       python datetime object of start date of range
    :param end_dto:         python datetime object of end date of range
    :param outdir:          the folder to save the output landsat files in
    :param max_cloud_cover: maximum percent cloud cover that is acceptable to download the file.

    :return output_filelist: A list of tile names downloaded by this function.


    This function makes use of the amazon web service hosted Landsat 8 OLI data.
    It recieves an amazon web url for a single landsat tile, and downloads the desired files

    :param amazon_url:  url to amazons page hosting these landsat tiles
    :param tilename:    landsat tile name
    :param outdir:      output directory to place landsat data
    :param bands:       list of bands to download when not all are desired, options include
                        any of [1,2,3,4,5,6,7,8,9,10,11,"QA"]. The MTL file is ALWAYS downloaded.

    :return tilepath:   returns a filepath to the new landsat tile folder with .TIFs in it


    Simple downloads and extracts the most recent version of the scene_list
    text file for reference

        http://landsat-pds.s3.amazonaws.com/scene_list.gz

    :return scene_list_text_data:   returns a text data object with all
                                    the data on scene inventory on amazon WS.


    Fetch MODIS Land products from one of two servers. If this function
    runs and downloads 0 files, check that your inputs are consistent
    with the naming convention at the appropriate server address.

       http://e4ftl01.cr.usgs.gov
       ftp://n5eil01u.ecs.nsidc.org

    :param product:         MODIS product to download such as 'MOD10A1' or 'MYD11A1'
    :param version:         version number, usually '004' or '041' or '005'
    :param tiles:           list of tiles to grab such as ['h11v12','h11v11']
                            NOTE: for some MODIS products, the h and v are omitted.

    :param outdir :         output directory to save downloaded files
    :param start_dto:       datetime object, the starting date of the range of data to download
    :param end_dto:         datetime object, the ending date of the range of data to download
    :param force_overwrite: will re-download files even if they already exist

    :return out_filepaths:  a list of filepaths to all files created by this function


    Sub-function to determine  server properties for MODIS data product.
    returns http/ftp handles

    the two current servers where aqua/terra MODIS data can be downloaded are
        site1='http://e4ftl01.cr.usgs.gov'
        site2='n5eil01u.ecs.nsidc.org'

    :param product:  modis product such as 'MOD10A1'
    :param version:  modis version, usually '005', '004', or '041'

    :returns site:   server address where data can be found
    :returns ftp:    ftp handle for open ftp session
    :returns Dir:    subdirectory of server to further search for files of input product.


    Fetches TRMM data from an FTP server.

       ftp://trmmopen.gsfc.nasa.gov/trmmdata/ByDate/V07/

    :param start_dto:        datetime object for start date of desired range
    :param end_dto:          datetime object for end date of desired range
    :param outdir:           output directory where files should be saved (str)
    :param product_string:   the string for the desired product, options include
                             1B11, 1B21, 1CTMI, 2A12, 2A21, 2A23, 2A25, 2B31, 3B42,
                             3G25, 3G31. The usual precip product of interest is the
                             well known 3B42 data product.

    :param output_files:     a list of new filepaths created by this function


    function for fetching AIRS data from the following FTP servers

    level1: ftp://airsl1.gesdisc.eosdis.nasa.gov/ftp/data/s4pa/Aqua_AIRS_Level1
    level2: ftp://airsl2.gesdisc.eosdis.nasa.gov/ftp/data/s4pa/Aqua_AIRS_Level2
    level3: ftp://acdisc.gsfc.nasa.gov/ftp/data/s4pa/Aqua_AIRS_Level3


    fetches AVHRR-pathfinder data via ftp

    server: ftp://ftp.nodc.noaa.gov/pub/data.nodc/pathfinder/


    Fetches Multisensor Precipitation Estimates data from
    weather/noaa server at [http://water.weather.gov/precip/p_download_new/]

    :param start_dto:       datetime object for start date of desired range
    :param end_dto:         datetime object for end date of desired range
    :param outdir:          output directory where files should be saved (str)
    :param area:            area of interest, either "conus", "ak" or "pr"
                            for continental us, alaska, or Puerto Rico respectively

    :return output_files:   list of output files fetched by this function


        creates a list of all rasters in a directory, then passes this
        list to self.from_rastlist

        see ``from_rastlist``


        Loads up a list of filepaths as a time series. If filenames contain
        variant characters that are not related to date and time, a
        "fmt_unmask" may be used to isolate the datestrings from the rest
        of the filenames by character index.

        For an example filename ``"MYD11A1.A2013001_day_clip_W05_C2014001_Avg_K_C_p_GSC.tif"``
        We only want the part with the year and julian day in it ``"2013001"``
        So we can use

        .. code-block:: python

            fmt        = "%Y%j"
            fmt_unmask = [10,11,12,13,14,15,16]

        To indicate that we only want the 10th through 16th characters of the filenames
        to be used for anchoring each raster in a physical time.


Applies the dnppy.raster.null_set_range() function to every raster in rast_series


        Applies the dnppy.raster.many_stats() function to each
        of the lowest level subsets of this rast_series.


        splits the time series into individual time chunks

        used for taking advanced statistics, usually periodic
        in nature. Also useful for exploiting temporal relationships
        in a dataset for a variety of purposes including data
        sanitation, periodic curve fitting, etc.

        :param subset_units:
            subset_units follows convention of fmt. For example:
            %Y  groups files by year
            %m  groups files by month
            %j  groups file by julian day of year

        :param overlap_width:
            this variable can be set to greater than 0
            to allow "window" type statistics, so each subset may contain
            data points from adjacent subsets.

            overlap_width = 1 is like a window size of 3
            overlap_width = 2 is like a window size of 5

            WARNING: this function is imperfect for making subsets by months.
            the possible lengths of a month are extremely variant, so sometimes
            data points at the ends of a month will get placed in the adjacent
            month. If you absolutely require accurate month subsetting,
            you should use this function to subset by year, then use the
            "group_bins" function to bin each year by month. so,

        .. code-block:: python

                ts.subset("%b")     # subset by month

                ts.subset("%Y")     # subset by year
                ts.group_bins("%b") # bin by month

        :param cust_center_time:
            Allows a custom center time to be used! This was added so that
            days could be centered around a specific daily acquisition time.
            for example, its often useful to define a day as
            satellite data acquisition time +/- 12 hours.
            if used, "cust_center_time" must be a datetime object!

        :param discard_old:
            By default, performing a subsetting on a time series that already
            has subsets does not subset the master time series, but instead
            the lowest level subsets. Setting "discard_old" to "True" will
            discard all previous subsets of the time series and start subsetting
            from scratch.


        Sorts the time series into time chunks by common bin_unit

        used for grouping data rows together. For example, if one used
        this function on a 5 year dataset with a bin_unit of month,
        then the time_series would be subseted into 12 sets (1 for each
        month), which each set containing all entries for that month,
        regardless of what year they occurred in.

        :param fmt_units:
            %Y  groups files by year
            %m  groups files by month
            %j  groups file by julian day of year

        :param overlap_width:
            similarly to "make_subsets" the "overlap_width" variable can be
            set to greater than 1 to allow "window" type statistics, so
            each subset may contain data points from adjacent subsets.
            However, for group_bins, overlap_width must be an integer.

        :param cyclical:
            "cyclical" of "True" will allow end points to be considered adjacent.
            So, for example, January will be considered adjacent to December,
            day 1 will be considered adjacent to day 365.


        Returns datetime obj that is centered on the "unit" of the input datetime obj

        When grouping datetimes together, center times are important. This function allows
        a center time with units equal to the users input (years, months, days , ...) to be
        generated from the first datetime of the time series.

        :param datetime_obj:     any datetime object
        :param units:            units by which to center input datetime object
        :return center_datetime: returns centered datetime object.


        converts seconds to other time units

        :param seconds:  number of seconds
        :param units:    units to convert those seconds to

        :return: time equivalent of input seconds expressed as input units


        Creates a new time_series object, which is built from column statistics of this
        time_series's subsets. For example:

        Lets say we have a years worth of hourly temperature data, and we want to get
        daily summaries of temperature statistics. To do this, the syntax would look
        like this:

        .. code-block:: python

            temperature_ts.make_subsets(%d)
            daily_sum_ts = temperature_ts.subset_stats("Temp")

        This function is not yet finished.


        Some level 2 data products use a different naming scheme, interpret those here

        example -  MOD11_L2.A2015001.1105.041.2015005192527.hdf


        Parses the most universal format of MODIS naming conventions

        example - MYD11A1.A2013121.h11v05.041.2013122220607.hdf


    Extracts tifs from MODIS HDF files, ensures proper projection.

    :param file_list:    either a list of '.hdf' files from which data should be extracted,
                         or a directory containing '.hdf'  files.
    :param layer_list:   list of layer numbers to pull out as individual tifs should be integers
                         such as [0,4] for the 0th and 4th layer respectively.
    :param layer_names:  list of layer names to put more descriptive file suffixes to each layer
    :param outdir:       directory to which tif files should be saved
                         if outdir is left as 'None', files are saved in the same directory as
                         the input file was found.

    :return output_filelist: returns a list of all files created by this function


    Automatically identify appropriate MODIS files and mosaic them.

    This script will find and mosaic all MODIS tiles groups with different time names in a
    directory. It will automatically identify the date ranges in the MODIS filenames and
    iterate through the entire range while skipping dates for which there are not at least
    two tiles. Users should be mindful of file suffixes from previous processing.

    This script centers around the 'arcpy.MosaicToNewRaster_management' tool
    [http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001700000098000000]

    :param filelist:    the directory containing MODIS data or a list of modis files.
    :param pixel_type:  exactly as the input for the MosaicToNewRaster_management tool.
                        defaults to "32_BIT_FLOAT"
    :param bands:       exactly as the input for the MosaicToNewRaster_management tool.
                        defaults to 1
    :param m_method:    exactly as the input for the MosaicToNewRaster_management tool.
                        defaults to "LAST"
    :param m_colormap:  exactly as the input for the MosaicToNewRaster_management tool.
                        defaults to "FIRST"
    :param outdir:      the directory to save output files to. If none is specified, a
                        default directory will be created as '[indir]_Mosaicked'

    :return output_filelist: returns list of files created by this function.


    Give raster(s) proper MODIS sinusoidal projection metadata.
    Some MODIS data does not have an adequately defined projection
    for some software like arcmap to use

    :param file_list: a list of one or more filepaths


    Builds a header file for the input UAVSAR .grd file,
    allowing the data to be read as a raster dataset.

    :param folder:   the folder containing the UAVSAR .grd and .ann files


    Converts the input UAVSAR .grd file into units of decibels. Note
    that a .hdr file must be created and accompany the .grd/.inc files for this to work

    :param filename:    the full file path string for the .grd data file
    :return outname:    filepath to output file created by this function.


 Appends digits to duplicate items in a list. Used to ensure each
        header is a unique string so a column-wise dictionary can be built.

        For example, a text file with headers ``["name", "tag", "tag", "tag"]`` will
        be changed to have headers ``["name", "tag1", "tag2", "tag3"]``.

        :param headers:     list of string elements intended for use as headers.


        Builds column wise data dictionary structure out of
        row_data. (row_data is a list of rows, where each row is a list, so
        row_data is a list of lists). Col data is a single dictionary, where
        the keys are the "headers" and the value is the list of all values
        in that column from the top down.


        Builds row wise data from existing column data. The opposite of
        _build_col_data.


        writes the contents of this text file object as a CSV

        :param text_filepath:   output filepath to write csv .txt
        :param delim:           delimiter to use. defaults to comma


        simple default reader of a delimited file. Does not read fixed-width

        :param text_filepath:       csv filepath to read from
        :param delim:               delimiter to use, defaults to comma
        :param has_headers:         Set "False" if csv file has no headers
                                    (this is bad, you should give your file headers)


        Writes the contents of this text data object to a json file. Note that
        json format does `not` support complex numbers with imaginary components.
        Also note that json formats are dictionary like, in that they preserve
        relationships, but do not display the list of relationships in any particular
        order.

        :param json_filepath:   output filepath to write json
        :param row_wise:        set to TRUE to save each row as its own structure
        :param col_wise:        set to True to save each col as its own structure


        Reads the contents of this tdo from a json file created by the
        ``text_data.write_json()``  function. Please note that this text_data
        class is designed for use with tabular type data, so this should
        function will not read ALL json files in a satisfactory manner.
        Users wishing to read json files in a general sense should  simply
        use the ``json`` module and invoke ``json.loads`` and ``json.dumps``
        directly on their data.

        :param json_filepath:   json filepath to read from
        :param row_wise:        read json file objects in as rows
        :param col_wise:        read json file objects in as columns


        Adds parameters to the ioconfig object

        :param param_names:     A string, the name of the parameter
        :param param_values:    the value of the parameter. May be any built
                                in datatype. (bool, int, str, list, long, etc)

        when a param has been added or imported, its value may be accessed with

        .. code-block:: python

            ioconfig_object['param_name']


        Prepares the row data with nice visual formatting then calls
        the ``text_data.write_csv`` method.

        :param filepath:    filepath to write csv to. (.txt, .csv, etc)


        Reads the contents of a csv file generated by ``ioconfig.write()``,
        interprets and formats each of the variables to the state it was before
        exporting. Once finished, this the ioconfig object will have all
        its standard attributes including ``conf_dict``.

        :param filepath:    filepath to a csv or txt file generated by the
                            ``ioconfig.write`` method.


allows interpretation of config values based on type


    Text reader for DS3505 data (space delimited) with some fixes

    Weather data downloaded from the following website has a peculiarity
    [http://gis.ncdc.noaa.gov/map/viewer/#app=cdo&cfg=cdo&theme=hourly&layers=1&node=gi]
    in that it has some upercase T's that are rarely needed, but ruin otherwise
    uniform space formatting.

    :param filepath:     filepath to DS3505 data
    :param has_headers:  set False if filepath does not have headers. This doesn't seem
                         to ever happen for DS3505 data.
    :return tdo:         returns a text data object with DS3505 data in it.


    This function will estimate surface reflectance for Landsat 4 TM, 5 TM, 7 ETM+, or 8 OLI data.

    Note this function will calculate surface reflectance for Landsat 4, 5, and 7
    bands 1, 2, 3, 4, 5, and 7 or Landsat 8 bands 2, 3, 4, 5, 6, and 7. All 6 bands should be in the
    toa_folder and have "TOA_Ref" in their filenames as per the landsat.toa_reflectance convention.

    The Landsat 8 Coastal Aerosol band (1) and Cirrus band (9) will not be calculated as they do not
    have a corresponding band in TM or ETM+. To be performed on Top-of-Atmosphere Reflectance data
    processed with the landsat.toa_reflectance_457 or the landsat.toa_reflectance_8 function.

    Resources
        - DEM
            - NASA Shuttle Radar Topography Mission (SRTM) up to 30m resolution.
              [http://www2.jpl.nasa.gov/srtm/cbanddataproducts.html]
            - NASA Advanced Spaceborne Thermal Emission and Reflection Radiometer (ASTER)
              Global Digital Elevation Model (GDEM) [http://asterweb.jpl.nasa.gov/gdem.asp]
            - USGS National Elevation Dataset (NED) [http://nationalmap.gov/elevation.html]
              downloadable in 30 meter resolution through The National Map Viewer

        - Dew Point
            - NOAA Daily Observational Data: Global Summary of the Day (GSOD) - GIS Data Locator
              [http://gis.ncdc.noaa.gov/map/viewer/#app=clim&cfg=cdo&theme=daily&layers=0001&node=gis].
              Select a weather station within the Landsat scene's extent, follow the link,
              and enter the scene's acquisition date. This will output a text file, with
              dew point under DEWP. More NOAA climatic data available at
              [https://www.climate.gov/data/maps-and-data]

    :param meta_path:       The full filepath to the metadata file (ending in MTL.txt) for the dataset
    :param toa_folder:      The filepath to the folder containing the TOA_Ref tiffs to be processed
    :param dem_path:        The full filepath to a DEM tif that covers the desired Landsat scene
                            Note that the DEM should be resampled to the Landsat bands' resolution (30m)
                            and pixel alignment. Also ensure there are no gaps in the dataset.
    :param dew_point:       The number (e.g. 57.7) for the dew point at the time and place of scene acquisition
    :param outdir:          Output directory to save converted files. If left False it will save
                            output files in the toa_folder directory.
    :param kt:              Unitless turbidity coefficient. Default set at 1.0 for clean air.
                            Set at 0.5 for extremely turbid, dusty, or polluted air.

    :return output_filelist:  A list of all files created by this function


    Top of Atmosphere radiance (in Watts/(square meter x steradians x micrometers))
    conversion for landsat 8 data. To be performed on raw Landsat 8
    level 1 data. See link below for details:
    see here http://landsat.usgs.gov/Landsat8_Using_Product.php

    :param band_nums:   A list of desired band numbers such as [3, 4, 5]
    :param meta_path:   The full filepath to the metadata file for those bands
    :param outdir:      Output directory to save converted files.

    :return output_filelist:    List of filepaths created by this function.


    Top of Atmosphere radiance (in Watts/(square meter x steradians x micrometers))
    conversion for Landsat 4, 5, and 7 data. To be performed on raw
    Landsat 4, 5, or 7 level 1 data.

    :param band_nums:   A list of desired band numbers such as [3, 4, 5]
    :param meta_path:   The full filepath to the metadata file for those bands
    :param outdir:      Output directory to save converted files.

    :return output_filelist:    List of filepaths created by this function.


    Converts Landsat 8 TIRS bands to at satellite brightnes temperature in Kelvins

    To be performed on raw Landsat 8 level 1 data. See link below for details
    see here http://landsat.usgs.gov/Landsat8_Using_Product.php

    :param band_nums:   A list of desired band numbers, which should be [10,11]
    :param meta_path:   The full filepath to the metadata file for those bands
    :param outdir:      Output directory to save converted files. If left False it will save ouput
                        files in the same directory as input files.

    :return output_filelist: A list of all files created by this function


    Converts band 6 from Landsat 4 and 5 or bands 6 VCID 1 and 2 from Landsat 7
    to at satellite brightness temperature in Kelvins

    To be performed on raw Landsat 4, 5, or 7 level 1 data.

    :param meta_path:   The full filepath to the metadata file, labeled '_MTL.txt', which must
                        be in the same folder as band 6 or 6_VCID_1 and 6_VCID_2
    :param outdir:      Output directory to save converted files. If left False it will save ouput
                        files in the same directory as input files.

    :return output_filelist: A list of all files created by this function


    Creates a cloud mask tiff file from the Landsat 8 Quality Assessment Band (BQA) file.
    Requires only the BQA tiff file included in the dataset.

    :param BQA_path:    The full filepath to the BQA file for the raw Landsat 8 dataset
    :param outdir:      Output directory to save cloudless band tifs and the cloud mask

    :return cloud_mask_path: Filepath to newly created cloud mask


    Creates a binary mask raster for removal of cloud-covered pixels in raw Landsat 4, 5, and 7 bands.

    To be performed on Landsat 4, 5, or 7 data. Must be processed first with landsat.toa_reflectance_457
    for bands 2, 3, 4, and 5 and landsat.atsat_bright_temp_457 for band 6.

    Note that for this function to run properly, bands 2, 3, 4, 5, and 6 must each be in the same folder
    and have the correct naming convention output by the landsat.toa_reflectance_457 and landsat.atsat_bright_temp_457
    functions (e.g. LT50410362011240PAC01_B2_TOA_Ref.tif, LT50410362011240PAC01_B6_Temp.tif).

    :param B2_TOA_Ref:      The full filepath to the band 2 top-of-atmosphere reflectance tiff file
    :param outdir:          Output directory to the cloud mask and TOA band tiffs
    :param Filter5Thresh:   Optional threshold value for Filter #5, default set at 2
    :param Filter6Thresh:   Optional threshold value for Filter #6, default set at 2

    :return cloud_mask_path: Filepath to newly created cloud mask


    Removal of cloud-covered pixels in Landsat 4, 5, 7, or 8 bands using the mask created with
    landsat.make_cloud_mask_8 or landsat.make_cloud_mask_457.

    :param folder:        The folder containing the raw or processed band tiffs to remove clouds from
    :param mask_path:     The full filepath to the mask file created by make_cloud_mask_8 or make_cloud_mask_457
    :param outdir:        Output directory to save cloudless band tiffs, default is same as "folder"

    :return no_clouds_list: List of files created by this function with cloud mask applied.


    Converts Landsat 8 bands to Top-of-Atmosphere reflectance. To be performed
    on raw Landsat 8 level 1 data. See link below for details
    see here [http://landsat.usgs.gov/Landsat8_Using_Product.php]

    :param band_nums:   A list of desired band numbers such as [3,4,5]
    :param meta_path:   The full filepath to the metadata file for those bands
    :param outdir:      Output directory to save converted files. If left False it will save ouput
                        files in the same directory as input files.

    :return output_filelist:    List of files created by this function


    This function is used to convert Landsat 4, 5, or 7 pixel values from
    digital numbers to Top-of-Atmosphere Reflectance. To be performed on raw
    Landsat 4, 5, or 7 data.

    :param band_nums:   A list of desired band numbers such as [3,4,5]
    :param meta_path:   The full filepath to the metadata file for those bands
    :param outdir:      Output directory to save converted files. If left False it will save ouput
                        files in the same directory as input files.

    :return output_filelist:    List of files created by this function


    Simple calculator of Normalized difference vegetation index on some Landsat 8 OLI
    data. Output file will have same name as inputs with "NDVI" in place of "B5", so
    inputs of files "LC80140342014347LGN00_B5.tif" and "LC80140342014347LGN00_B4.tif"
    will generate a file named "LC80140342014347LGN00_NDVI.tif"

    :param Band5:   The full filepath to the band 5 tiff file, the OLI NIR band
    :param Band4:   The full filepath to the band 4 tiff file, the OLI Visible Red band
    :param outdir:  directory to store output "NDVI" tiff

    :return ndvi8:  Name of output file created by this function


    Simple calculator of Normalized difference vegetation index on some Landsat 4/5/7 TM/ETM+
    data. Output file will have same name as inputs with "NDVI" in place of "B5", so
    inputs of files "LC70140342014347LGN00_B4.tif" and "LC70140342014347LGN00_B3.tif"
    will generate a file named "LC70140342014347LGN00_NDVI.tif"

    :param Band4:   The full filepath to the band 4 tiff file, the TM/ETM+ NIR band
    :param Band3:   The full filepath to the band 3 tiff file, the TM/ETM+ Visible Red band
    :param outdir:  directory to store output "NDVI" tiff

    :return ndvi457:  Name of output file created by this function


    This function makes use of the amazon web service hosted Landsat 8 OLI data.
    This allows the user to identify the path/row and year/day to automatically download
    a scene of OLI data. The code below downloads each band tiff in the dataset.

    *Note: for best results, enter number inputs in quotemarks as strings.
    Some identifier integers may be read by Python wrong (e.g. 010 is read as 8 in binary)

    *You can use this tool to find the Path/Row values based on Latitude/Longitude coordinates.
    https://landsat.usgs.gov/tools_latlong.php

    *You can refer to this table to find the Julian Day value for your desired dataset
    http://amsu.cira.colostate.edu/julian.html

    Inputs:
        path        the Landsat path number for the desired dataset
        row         the Landsat row number for the desired dataset
        year        the four digit year number the desired dataset was created
        day         the three digit Julian Day number the desired dataset was created (e.g. January 1 = 001)
        outdir      the output location for the downloaded Landsat 8 dateset


    An idea for making use of the amazon web service hosted Landsat 8 OLI data.
    This will allow a user to identify the path/row and year/day to automatically download
    a time series of OLI data. The code below downloads each band tiff on the given url.

    Inputs:
        path               the path number for the desired scene series, entered preferably as a
                                three-digit string, e.g. "xxx"
        row                the row number for the desired scene series, entered preferably as a
                                three-digit string, e.g. "xxx"
        start_yyyy_mm_dd   year-month-day ("xxxx-xx-xx", "xxxx/xx/xx", or "xxxx_xx_xx")
        end_yyyy_mm_dd     year-month-day ("xxxx-xx-xx", "xxxx/xx/xx", or "xxxx_xx_xx")
        outdir             the folder to save the output files in


        builds filepaths for band filenames from the MTL file

        in the future, methods associated with landsat scenes,
        (for example: NDVI calculation) could save rasters in the scene
        directory with new suffixes then add attribute values to the MTL.txt
        file for easy reading later, such as:

        FILE_NAME_PROD_NDVI = [filepath to NDVI tif]


    Calculates surface temperature from Landsat 8 OLI and TIRS data. Requires band 4 and 5
    Top-of-Atmosphere Reflectance tiffs and the unprocessed band 10 and 11 tiffs.

    Note: if the default values of 0, 1, and 0 are used for the Path Radiance, Narrowband \
    Transmissivity, and Sky Radiance constants, atmospheric conditions will not be accounted
    for and the surface values may be off. Values are attainable using MODTRAN.

    :param band4_toa:   Filepath to the Band 4 Top-of-Atmosphere Reflectance tiff.
                        use landsat.toa_reflectance_8
    :param meta_path:   Filepath to the metadata file (ending in _MTL.txt)
    :param path_rad:    Path Radiance constant (default 0)
    :param nbt:         Narrowband Transmissivity constant (default 1)
    :param sky_rad:     Sky Radiance constant (default 0)
    :param outdir:      Path to the desired output folder. If left False the
                        output tiff will be place in band4_toa's folder
    :param L:           Soil brightness correction factor, between 0 and 1. used to calculate
                        Soil Adjusted Vegetation Index. Default L = 0.5 works well in
                        most situations. when L = 0, SAVI = NDVI.

    :return surface_temp_8:    Full filepath of tif created by this function


    Calculates surface temperature from Landsat 4/5 TM or 7 ETM+ data. Requires
    band 3 and 4 Top-of-Atmosphere Reflectance tiffs and the unprocessed band
    6 (or 6_VCID_1 for Landsat 7) tiff.

    Note: if the default values of 0, 1, and 0 are used for the Path Radiance, Narrowband
    Transmissivity, and Sky Radiance constants, atmospheric conditions will not be accounted
    for and the surface values may be off. Values are attainable using MODTRAN.

    :param band3_toa:   Filepath to the Band 3 Top-of-Atmosphere Reflectance tiff.
                        use landsat.toa_reflectance_457
    :param meta_path:   Filepath to the metadata file (ending in _MTL.txt)
    :param path_rad:    Path Radiance constant (default 0)
    :param nbt:         Narrowband Transmissivity constant (default 1)
    :param sky_rad:     Sky Radiance constant (default 0)
    :param outdir:      Path to the desired output folder. If left False the
                        output tiff will be place in band4_toa's folder
    :param L:           Soil brightness correction factor, between 0 and 1. used to calculate
                        Soil Adjusted Vegetation Index. Default L = 0.5 works well in
                        most situations. when L = 0, SAVI = NDVI.

    :return surface_temp_457:    Full filepath of tif created by this function


reads the contents of an MTL file


    Function converts lat/lon to UTM zone coordinates. Equations from USGS
    bulletin 1532. East and North are positive, South and West are negative.

    :param lat:             latitude value in degrees (East is positive)
    :param lon:             longitude value in degrees (North is positive)
    :param utm_zone:        UTM zone number as an integer, without the "S" or "N"
    :param hemisphere:      hemisphere for UTM zone, either "S", or "N"

    :return:                UTM_easting, UTM_northing


    This function builds the datatype_library dict out of file datatype_library.csv
    and returns it. Adding to this datatype library should be done by editing
    the csv file, not this code. Note that the standard format for names is
    ``<product short name>_<resolution identifier>_<coverage area>``, such as
    "TRMM_1.0_GLOBAL", or "GPM_IMERG_0.1_GLOBAL".

    Geotransform math used to create the array [A, B, C, D, E, F]

    .. code-block:: python

        x = A + iB + jC
        y = D + iE + jF

    Where x,y are real spatial coordinates, and i,j are matrix indices.
    A, B, C, D, E, F and are coefficients that make up the geotransformation array.

    :return datatype_library_dict: A dictionary


print summary of entire datatype library


    NOTE: This is functionally identical to ``_extract_HDF_layer_data``, but employs
    an h5py based approach instead of gdal. It is experimental, and not yet used
    anywhere.

    Extracts one or more layers from an HDF5 file and returns a dict of numpy arrays

    :param hdfpath:     Filepath to an HDF5 file
    :param layers:      A list of integer values or layer names to extract
                        leave "None" to return numpy arrays for ALL layers

    :return layer_dict: Dict with band names as keys and numpy arrays as values


    extracts SMOS data from its native NetCDF format.

    :param netcdf_list:     list of hdf files or directory with netcdfs
    :param layer_indexs:    list of integer layer indices
    :param outdir:          directory to place outputs
    :param area:            presently only supports "CONUS"

    :return:                A list of all files created as output


    Extracts all time layers from a "Global Climate Model Output" NetCDF layer

    :param netcdf_list:     List of netcdfs from CORDEX climate distribution
    :param variable:        The climate variable of interest (tsmax, tsmin, etc)
    :param outdir:          Output directory to save files.

    :return output_filelist: returns list of files created by this function


    Input list of filepaths OR a directory path with compressed
    files in it. Attempts to decompress the following formats

    Support formats include ``.tar.gz``, ``.tar``, ``.gz``, ``.zip``.

    :param filepaths:           list of filepaths to archives for extraction
    :param delete_originals:    Set to "True" if archives may be deleted after
                                their contents is successful extracted.


    This function wraps "_extract_NetCDF_layer_data" and "_gdal_dataset_to_tif".
    It only works for datatypes listed in the datatype_library.csv

    :param netcdf:          a single netcdf filepath
    :param layer_indexs:    list of int index values of layers to extract
    :param outdir:          filepath to output directory to place tifs
    :param datatype:        a dnppy.convert.datatype object created from an
                            entry in the datatype_library.csv
    :param force_custom:    if True, this will force the data to take on the
                            projection and geotransform attributes from
                            the datatype object, even if valid projection
                            and geotransform info can be pulled from the gdal
                            dataset. Should almost never be True.
    :param nodata_value:    the value to set to Nodata

    :return:                list of filepaths to output files


    converts numpy dtype to a gdal data type object

    :param numpy_dtype_string
    :return gdal_datatype_object:


    Extracts TRMM products from HDF to tif.
    http://pmm.nasa.gov/data-access/data-products

    :param hdf_list:        list of hdf files or directory with hdfs
    :param layer_indexs:    list of integer layer indexs
    :param outdir:          directory to place outputs
    :param resolution:      The size of a pixel in degrees, either
                            "0.25", "0.5", "1.0", "5.0" depending on
                            the specific TRMM product you are extracting.
    :return:                a list of all files created as output


    This function will convert a folder of GRACE Data Assimilation product binary files into individual tiffs
    or a single three-dimensional NumPy array. The input folder should contain only the binary files.

    For more information on GRACE Data Assimilation products, visit
    [http://drought.unl.edu/MonitoringTools/NASAGRACEDataAssimilation.aspx]

    :param folder:      the full path to the folder containing the binary files to be converted
    :param outdir:      Optional full path to the desired output folder. if left False by default,
                        the output file(s) will be place in the input folder
    :param npy_file:    Option to save the data as a 3-dimensional NumPy array file instead
                        of tiffs enter True to convert data to a single .npy file. if left False by
                        default, each binary file will be converted to tiff format instead

    :return outlist:    returns list of files created by this function


    Function converts NetCDFs to tiffs. Designed to work with TRMM data
    downloaded from GLOVIS

    :param filelist:            list of '.nc' files to convert to tifs.
    :param outdir:              directory to which tif files should be saved

    :return output_filelist:    list of local filepaths of extracted data.


    This function wraps "_extract_HDF_layer_data" and "_gdal_dataset_to_tif"
    It only works for datatypes listed in the datatype_library.csv

    :param hdf:             a single hdf filepath
    :param layer_indexs:    list of int index values of layers to extract
    :param outdir:          filepath to output directory to place tifs. If left
                            as "None" output geotiffs will be placed right next to
                            input HDF.
    :param datatype:        a dnppy.convert.datatype object created from an
                            entry in the datatype_library.csv
    :param force_custom:    if True, this will force the data to take on the
                            projection and geotransform attributes from
                            the datatype object, even if valid projection
                            and geotransform info can be pulled from the gdal
                            dataset. Should almost never be True.
    :param nodata_value:    the value to set to Nodata

    :return:                list of filepaths to output files