GithubHelp home page GithubHelp logo

earthlab / earthpy Goto Github PK

View Code? Open in Web Editor NEW
478.0 19.0 160.0 2.4 MB

A package built to support working with spatial data using open source python

Home Page: https://earthpy.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Python 98.09% Makefile 0.22% TeX 1.69%
spatial-data raster vector python education

earthpy's People

Contributors

andykeeton25 avatar annaspiers avatar arfon avatar betatim avatar bmcandr avatar cstuart7 avatar dcslagel avatar eculler avatar faranido avatar hdumke avatar jeje1140 avatar katysill avatar leouieda avatar mbjoseph avatar mcosmos12 avatar mcshanec avatar mgraber avatar mikedorfman avatar mlevis1 avatar nkorinek avatar powerchell avatar pyup-bot avatar sgillies avatar shwh2628 avatar tkarfs1 avatar willskor avatar windnage avatar wwicherski avatar yojihigh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

earthpy's Issues

history is lost

hey @choldgraf i moved the earthlab module over here! i had attempted to preserve the entire history but that didn't work. I may try again but let me know if you think that history is imperative!

Potential envt issues

not sure if this is a thing yet or not but...

Running setup.py bdist_wheel for earthpy ... done
  Stored in directory: /private/var/folders/43/4q82487d5xsfpxdx6nl_c1wmhckx08/T/pip-ephem-wheel-cache-9jj3bwkx/wheels/3f/df/1c/6aad6ef509d5c33973e83bdcc68b02460d390b7661e2a6bb8f
Successfully built earthpy
geocoder 1.33.0 requires future, which is not installed.
contextily 0.99.0 requires pytest, which is not installed.
boto3 1.5.14 has requirement botocore<1.9.0,>=1.8.28, but you'll have botocore 1.5.92 which is incompatible.
Installing collected packages: earthpy
  Found existing installation: earthpy 0.0.1-git
    Uninstalling earthpy-0.0.1-git:
      Successfully uninstalled earthpy-0.0.1-git
Successfully installed earthpy-0.0.1-git

Updating docstrings in io.py EarthlabData class to match updated functionality, updating docstring in utils.py to be more robust

Identify the Documentation Element That You Propose to Update

  1. The get_data() in the EarthlabData class in io.py docstring parameters don't match the parameters in the function.
    2 . There is an incomplete docstring for the function fix_paths() in utils.py

Please Identify Your Proposed Changes Below

Updating the docstring for get_data() in the EarthlabData class in io.py to match the updated parameters that the function takes. Additionally, updating the utils fix_paths() function docstring in order to note the inputs and returns.

Normalized diff function - What order would a user expect the bands to be in?

Currently we have a normalized_diff() function which calculated norm diff of 2 bands.
It's nice and generic in that it can be used on ANY raster data BUT question

  1. is the band order what a user would expect? i think it's the OPPOSITE of what i taught in my R class.
  2. the name could be shorter. SHould i rename it to norm_diff() ?

hey @mbjoseph @joemcglinchy @jlpalomino have a look at the function and see what you think. I won't change it during the semester but am open to changing it in December if you guys think it should be the opposite? Or is it ok?

Add vignette to normalized_diff (spatial.py) AND add vignette to plot_bands (spatial.py)

Identify the Documentation Element That You Propose to Update

  1. Add vignette to normalized_diff function in spatial.py

  2. Add vignette to plot_bands function in spatial.py

Please Identify Your Proposed Changes Below

  1. Add

import numpy as np

import earthpy.spatial as es

red_band = np.array([[1, 2, 3, 4, 5],[11,12,13,14,15]]) nir_band = np.array([[6, 7, 8, 9, 10],[16,17,18,19,20]]) # Calculate normalized difference ndiff = es.normalized_diff(b2=nir_band, b1=red_band)

  1. Add

import earthpy.spatial as es

titles = ["Red Band", "Green Band", "Blue Band", "Near Infrared (NIR) Band"]

# Plot all bands of a raster tif es.plot_bands(naip_image, title=titles, figsize=(12,5), cols=2)

Docs Docs Docs - We need docs

We have none. and we desperately need to begin documenting this package. This is the start of this effort...

  1. setup readthe docs account
  2. setup docs folder
  3. hopefully @betatim can help us with an autobuild for this to make life easier!
  4. maybe @jlpalomino can help me and we can get maybe joe even to pitch in to help with just a bit of documentation? or an intern could do this too?

(1) Update docstring for cols variable in spatial.py/plot_bands f(x) for spelling and default value and (2) Update formatting of variables in plot_rgb and plot_bands functions.

Identify the Documentation Element That You Propose to Update

  1. Line 290 in spatial.py - fix the spelling error and update to reflect that default is 3 columns if none is specified.
  2. Docstrings for plot_rgb and plot_bands have inconsistent formatting of data types for variables and descriptions.

Please Identify Your Proposed Changes Below

  1. Update spelling of "columsn" to "columns", add a default value of 3.
  2. Format variables within the docstrings of plot_rgb and plot_bands functions mimicking the rasterio function documentation format as specified.

example change in plot_rgb:
rgb: list, indices of the three bands to be plotted (default = 0,1,2)
would be modified to:
rgb: list (default = 0,1,2)
Indices of the three bands to be plotted

Cloudmask Functions

Here is a start at some functions to handle cloud masks. Currently they are very modular and super focused as written. Let's start a discussion around what types of functions would be most useful for typical modis and landsat workflows where you are removing cloudy pixels.

@joemcglinchy @mbjoseph


def make_cloud_mask(mask_arr, vals):
    """Take an input single band mask layer such as a pixel_qa 
    layer for MODIS or Landsat and apply a mask given a range of vals to mask

    Parameters
    -----------
    mask_arr : numpy array
        A array... to open the pixel_qa or mask raster of interest
    vals : list of numbers (int or float)
        A list of values that represent no data in the provided raster layer (arr)
        
    Returns
    -----------
    arr : numpy array
        A numpy array with values that should be masked set to 1 for True (Boolean)
    """

    # this might require a lambda
    for cval in vals:
        mask_arr[mask_arr == cval] = 1
    return(mask_arr)


def apply_cloud_mask(arr, the_mask):
    # Create a mask for all bands in the landsat scene
    cl_mask = np.broadcast_to(the_mask == 1,
                              arr.shape)

    # If the user provides a masked array, combine masks
    if isinstance(arr, np.ma.MaskedArray):
        cl_mask = np.logical_or(arr.mask, cl_mask)

    # Return combined mask
    return (ma.masked_array(arr, mask=cl_mask))


def make_apply_mask(arr, mask_arr, vals):
    cl_mask = make_cloud_mask(mask_arr, vals, arr)
    return (apply_cloud_mask(arr, cl_mask))




Correct spelling, reword content in spatial-raster.rst and Add summary description of earthpy to index.rst

Identify the Documentation Element That You Propose to Update

spatial-raster.rst

  1. Correct spelling in Line 16. Misspelled word in BOLD text:
    All files in the list must be in the same Coordinate **Refenence** System (CRS) and

  2. Reword content to better flow below:

   The stack_raster_tifs function takes a list of raster paths and turns that list into an

        1.  a stacked geotiff on your hard drive and
        2.  (optionally) an output raster stack in numpy format with associated metadata.

index.rst

  1. Add documentation that describes the purpose of this file. It seems to follow Sphinx (Python Documentation Generator)
    http://www.sphinx-doc.org/en/1.6/markup/toctree.html

Please Identify Your Proposed Changes Below

Correction made in BOLD text for spatial-raster.rst:

  1. All files in the list must be in the same Coordinate Reference System (CRS) and

  2. The stack_raster_tifs function takes a list of raster paths and turns the list into the following:

    1. a stacked geotiff on your local hard drive and
    2. (optional) an output raster stack in numpy format with associated metadata.

Use the Sphinx documentation to describe the following element and options in index.rst:
Element:
.. toctree::

Options:

  :maxdepth: 2
  :caption: Contents:

Include a comment that states the elements and options are applied to the following documents"
Documents:

 get-started
 spatial-raster
 spatial-vector

(1) Remove commented shp_sub line from earthpy/clip.py & (2) add .DS_Store to .gitignore file

Issue 1

Identify the Documentation Element That You Propose to Update

Line 32 in earthpy/clip.py defines shp_sub, but is commented out with an alternative line of code below that defines object. This commented out line will not be used and should be removed (penultimate line below)

# Get a list of id's for each road line that overlaps the bounding box and subset the data to just those lines`
sidx = list(spatial_index.intersection(bbox))
#shp_sub = shp[shp.index.isin(sidx)]
shp_sub = shp.iloc[sidx]

Please Identify Your Proposed Changes Below

Remove line 32

# Get a list of id's for each road line that overlaps the bounding box and subset the data to just those lines`
sidx = list(spatial_index.intersection(bbox))
shp_sub = shp.iloc[sidx]

Issue 1

Identify the Documentation Element That You Propose to Update

Earth Analytics class repository

Please Identify Your Proposed Changes Below

Add .DS_Store to .gitignore file on Earth Analytics class repository

Adding new argument to spatial-raster.rst and changing comments in Spatial.py to PEP8 format

Identify the Documentation Element That You Propose to Update

  1. the spatial-raster.rst file is missing a parameter.

  2. Spatial.py has a lot of code that needs to be put in PEP8 format. Comments don't start with capitalized first letter, some comments are notes to other contributors and should be rephrased to be a "to do" instead of a comment to oneself.

Please Identify Your Proposed Changes Below

  1. The arr_out function is not in the .rst file but it is in the spatial.py file.

  2. Starting letter in comments are not capitalized. Comments can also be more clear.
    This comment should be rephrased.
    https://github.com/earthlab/earthpy/blob/master/earthpy/spatial.py#L66
    This comment referencing an issue with the "current" matplotlib but does not specify what the current matplotlib is.
    https://github.com/earthlab/earthpy/blob/master/earthpy/spatial.py#L252
    This comment should be changed
    https://github.com/earthlab/earthpy/blob/master/earthpy/spatial.py#L345

make a plot_hist function

Currently a bit of looping is required to plot a bunch of histograms in a raster stack

colors = ['r', 'g', 'b', 'k']
titles = ['red band','green band','blue band','nir band']
fig, axs = plt.subplots(2, 2, figsize=(10, 10), sharex=True, sharey=True)
for band, color, the_title, ax in zip(naip_csf, colors, titles, axs.ravel()):
    ax.hist(band.ravel(), bins=20, color=color, alpha=.8)
    ax.set_title(the_title)

Create a small function to handle hist plotting without all of the loops. it's just better that way.

potential arguments:

  • bins
  • color(s)
  • title(s)
  • figsize (it's stupid for me to provide 2 arguments. i should just have [a,b] and call each at the correct index in the function

** i wonder if i could send a **kwargs dict object to be unpacked with a set of all the hist options. that would be much more flexible than the way i'm writing things now...

plot_rgb and masked numpy arrays -- BUG

Currently there is a "Feature" in numpy where if you mask an array with no actual maskable values you get a pseudo mask array. Now... this breaks plot_Rsb...more later

Update spatial.py module to use pep8 and add crop_image docs

Identify the Documentation Element That You Propose to Update

  • I would like to update the spatial.py module to use pep8 syntax. I plan to capitalize all of the comments, fix spacing and reorder imports following contributing guidelines.
  • i would also

Please Identify Your Proposed Changes Below

Add missing "title" parameter to plot_bands documentation AND make a rst for plot_bands function

Identify the Documentation Element That You Propose to Update

  1. the parameter "title" is not included under the parameters list for the function plot_bands.
  2. There is currently no RST documentation for the function plot_bands in the online documentation

Please Identify Your Proposed Changes Below

  1. I will add the "title" parameter to the list and add the type and a brief explanation of this parameter under the function plot_bands.
  2. I will add the RST documentation for plot_bands under the "doc", "spatial-raster.rst"

Plot Individual Bands Function

Make this a function to plot each band in a stack. it's way too much for to plot it as it is now.

inputs

  1. number of colums??
  2. n dimensional numpy array
  3. optional - cmap to use??
# calculate the total rows that will be required to plot each band 
# this could be a function too 
plot_rows = int(np.ceil(landsat_pre_fire.shape[0] / 3))
total_layers = landsat_pre_fire.shape[0]

# plot all bands
fig, axs = plt.subplots(plot_rows, 3, figsize=(15, 15))
axs_ravel = axs.ravel()
for ax, i in zip(axs_ravel, range(total_layers)):
    band = i+1
    ax.imshow(et.spatial.bytescale(landsat_pre_fire[i]), cmap='Greys')
    ax.set(title='Band %i' %band)
    ax.set(xticks=[], yticks=[])
# this loop clears out the plots for bands 8-9 which are empty
# but you have to populate them in matplotlib when you specify plot rows and cols
for ax in axs_ravel[total_layers:]:
   ax.set_axis_off()
   ax.set(xticks=[], yticks=[])
    
plt.tight_layout()

Add missing doc strings to the clip_points and clip_line_poly functions

Identify the Documentation Element That You Propose to Update

I would like to add documentation to two functions: clip_points and clip_line_poly. Currently there is no documentation describing the functions or the arguments. Both files found in clip.py.

Please Identify Your Proposed Changes Below

I would like to add a description of the function and a description of each argument in each function. Ensuring that PEP8 is used throughout function. Adding a statement on where and how each argument is used.

Remove commented out code from crop_image

Identify the Documentation Element That You Propose to Update

crop_image has commented out code

Please Identify Your Proposed Changes Below

Delete commented out code from crop_image

Finding a home for earthpy's dependencies

Currently this repo contains an environment.yml file that is very similar (but not identical) to the environment.yml file for the earth analytics class conda environment.

But, this package has dependencies that aren't needed for the class, and the class has dependencies that aren't needed for this package. One solution to this is to deal with the environment for this package separately from the environment for the class (but still make sure that students using the class environment can use this package).

From what I can gather from https://python-packaging.readthedocs.io/en/latest/dependencies.html, the convention is to use install_requires in setup.py (https://github.com/earthlab/earthpy/blob/master/setup.py#L33-L34) to specify the minimal set of requirements for users to install and use the package. But, it also seems like we could use a requirements.txt file or an environment.yml file.

So my question is: Which of the three options (install_requires, requirements.txt, and environment.yml) is better in this case for ensuring that this package complies with typical practice, and that the package works with the earth analytics class conda environment?

Spatial.py edit documentation and import libraries to pep8 guidelines; suggest code edit for normalized_diff & stack_raster_tifs

Identify the Documentation Element That You Propose to Update

Edit the documentation to match pep8 guidelines and rearrange the import libraries to follow pep8 guidelines wherein more general libraries are listed first and more specific libraries after.

Also delete comments that seem unnecessary, and add comments to suggest a change to normalized_diff function to make it less confusing

Please Identify Your Proposed Changes Below

Documentation should begin with a space and follow with a capital letter (i.e ' # Comment here')

Importing should begin with the most general libraries first

Delete comments such as
1.) #ndvi[np.isnan(ndvi)] = 0 : commented out in normalized_diff function
2.) # Should this wrap around show instead of plotting as it does? : commented in plot_rgb
3.) #ax.set(xticks=[], yticks=[]) :commented out in the hist function

Add comments
1.) For normalized_diff function to suggest a change ( # Could be confusing if one does not know that b2 is subtracted from b1.
#An individual might assume the first input is subtracted from the second.
#For example, it could be more commonly assumed : (b1-b2)/(b1+b2) )

2.) Add comment for stack_raster_tifs function to include .sort()

delete commented out code in io.py, update fix_paths function in documentation

Identify the Documentation Element That You Propose to Update

I am going to delete commented code in the io.py section of earthpy and update the fix_paths function section in the earthpy docs

Please Identify Your Proposed Changes Below

I am going to delete lines 17-19, 25, and 29-30, which are commented-out code

before:

#    'week_02': [('https://ndownloader.figshare.com/files/7010681', 'boulder-precip.csv', 'file'),
#                ('https://ndownloader.figshare.com/files/7010681', 'temperature_example.csv', 'file'),
#                ('https://ndownloader.figshare.com/files/7426738', '.', 'zip')],
    'co-flood-extras': [('https://ndownloader.figshare.com/files/7010681', 'boulder-precip.csv', 'file'),
                    ('https://ndownloader.figshare.com/files/7010681', 'temperature_example.csv', 'file')],
    'colorado-flood': ('https://ndownloader.figshare.com/files/12395030', '.', 'zip'),
    'spatial-vector-lidar': ('https://ndownloader.figshare.com/files/12459464', '.', 'zip'),
    'cold-springs-modis-h5': ('https://ndownloader.figshare.com/files/10960112', '.', 'zip'),
    #'week_05': ('https://ndownloader.figshare.com/files/7525363', '.', 'zip'),
    'cold-springs-fire': ('https://ndownloader.figshare.com/files/10960109', '.', 'zip'),
    'cs-test-naip': ('https://ndownloader.figshare.com/files/10960211?private_link=18f892d9f3645344b2fe', '.', 'zip'),
    'cs-test-landsat': ('https://ndownloader.figshare.com/files/10960214?private_link=fbba903d00e1848b423e', '.', 'zip'),
    #'week_08': [('https://ndownloader.figshare.com/files/9666637?private_link=480fba92b3e882c4d35d', 'week_08', 'zip'),
    #            ('https://ndownloader.figshare.com/files/9666637?private_link=480fba92b3e882c4d35d', 'week_08-hw', 'tar')],
}```

after:

```# deprecating week 2 & 8 data given i've reorganized these data into single repos
    'co-flood-extras': [('https://ndownloader.figshare.com/files/7010681', 'boulder-precip.csv', 'file'),
                    ('https://ndownloader.figshare.com/files/7010681', 'temperature_example.csv', 'file')],
    'colorado-flood': ('https://ndownloader.figshare.com/files/12395030', '.', 'zip'),
    'spatial-vector-lidar': ('https://ndownloader.figshare.com/files/12459464', '.', 'zip'),
    'cold-springs-modis-h5': ('https://ndownloader.figshare.com/files/10960112', '.', 'zip'),
    'cold-springs-fire': ('https://ndownloader.figshare.com/files/10960109', '.', 'zip'),
    'cs-test-naip': ('https://ndownloader.figshare.com/files/10960211?private_link=18f892d9f3645344b2fe', '.', 'zip'),
    'cs-test-landsat': ('https://ndownloader.figshare.com/files/10960214?private_link=fbba903d00e1848b423e', '.', 'zip'),
}```

I am going to add docstring documentation for the fix_paths function in earthpy

es.norm dif -- divide by 0 warning.

Currently when you run norm_diff if there is a divide by 0 issue you get the following warning:

/Users/leah-su/Documents/github/1-python/earthpy/earthpy/spatial.py:76: RuntimeWarning: divide by zero encountered in true_divide
  n_diff = (b2 - b1) / (b2 + b1)

This warning comes from numpy and just informs the user that they were a divide by 0 issue! But it actually simply provides that cell with a "na" value so it works as you might think it would. Look into whether it's possible to throw a slightly more friendly error that says - warning: divide by 0. Cells that have this issue calculated with be assigned "NA". I'm not sure if there is a clever way to actually do this or not given the warning is thrown via numpy but it's worth looking into .

Add unit tests to Crop_image function

  • Ensure that crop_image fun is provided with inputs in the right format (assert in the function
  • Ensure that the crop_image function raises an error if the incorrect formats are provided
    @mbjoseph assigning this to you given today's meeting!

Reorder the libraries in utils.py and delete commented out code from _init_.py

Identify the Documentation Element That You Propose to Update

utils.py is not following pep8 conventions in regards to the order of imported libraries.
There is some code that has been commented out in _init_.py.

Please Identify Your Proposed Changes Below

I will reorder the order of libraries being imported in utils.py following pep8 conventions.
I will delete the commented out code from _init_.py

Update spatial.py to conform to PEP-8 standards and update returns in spatial.py docstrings

Identify the Documentation Element That You Propose to Update

  1. Update spatial.py to conform to PEP-8 standards.
  2. Update several docstrings in spatial.py to include/update returned variables.

Please Identify Your Proposed Changes Below

Proposed change 1

a. Remove spaces around keyword assignments and adding spaces after commas on the following lines: 138, 170, 174, 175, 250, 282, 332, 338, 339, 340, 341, 342, 343, 344, 393, 394, 401, 402, 403, 404.
b. Fix indentation on the following lines: 131, 132, 133, 134, 135, 301, 321, 322, 393, 425, 444.
c. Break up lines that are greater than 120 characters (in a couple of locations).
d. Remove an unused import from rasterio.mask import mask

Proposed change 2

a. Function docstrings that need a description of the return added: normalized_diff(), stack_raster_tifs().
b. Function docstrings that need their return description updated: plot_bands() (Function doesn't actually return anything. Should this return the plt and/or ax object?), plot_rgb() (Function doesn't actually return anything. Should this return the ax object as described?), hist() (Function doesn't actually return anything. Should this return the plt and/or ax object?)

draw_legend is not ready to use

Currently there is a draw_legend function that is supposed to make creating a nice legend for a plot easier. However as it is built, it's not general enough to use consistently.

I think i should remove it for the time being until it's fully tested but just noting here that right now it's in the package and really does not work.

Clarify module descriptions in rst AND delete unused file path checks, context managers, and input type checks in spatial.py

Identify the Documentation Element That You Propose to Update

  1. In get-started.rst, the description of the modules as "Spatial IO Utils", is unclear. It looks like it is one module that has utils for input/output of spatial data.
  2. Delete commented out lines in spatial.py. The first two are tests that aren't included in the actual function. The third is unused with statement.

Please Identify Your Proposed Changes Below

  1. I will change modules description to a bulleted list
  2. I will delete the above commented lines, unless the first two checks should be included uncommented.

Add RST documentation to spatial-raster.rst for the functions plot_rgb() and hist() located in spatial.py

Identify the Documentation Element That You Propose to Update

  1. Add RST documentation to spatial-raster.rst for the function plot_rgb()
  2. Add RST documentation to spatial-raster.rst for the function hist()

Please Identify Your Proposed Changes Below

Plot RGB


The ``plot_rgb`` function plots each layer in a raster stack converted into a numpy array for quick visualization.

``plot_rgb`` takes 8 input parameters:

``arr``: numpy array
           An n-dimension numpy array in rasterio band order (bands, x, y)
``rgb``: list
           Indices of the three bands to be plotted (default = 0,1,2)
``extent``: tuple - optional
          The extent object that matplotlib expects (left, right, bottom, top)
``title``:  string- optional 
          String representing the title of the plot
``ax``: matplotlib AxesSubplot 
          The ax object where the ax element should be plotted. Default = none
``figsize``: tuple
          The x and y integer dimensions of the output plot if preferred to set.
``stretch``: boolean
          If True, a linear stretch will be applied
``str_clip``: int
         The % of clip to apply to the stretch. Default = 2 (2 and 98)

The ``plot_rgb`` function returns the following:

``fig, ax``: figure object, axes object
         The figure and axes object associated with the 3 band image.  If the ax keyword is specified, the figure return will be None.

Example:

.. code-block:: python

    import matplotlib as plt
    import earthpy.spatial as es

    fig, ax1 = plt.subplots(figsize=(12, 6))
    es.plot_rgb(naip_image,
                       rgb=[0, 1, 2],
                       extent=naip_extent,
                       title="NAIP 2017 Post Fire RGB Image",
                       ax=ax1)

2. 
Histogram 

The hist() function plots a histogram of each layer in a raster stack converted into a numpy array for quick visualization.

hist() takes 6 input parameters:

arr: numpy array
An dimension numpy array
title: list
A list of title values that should either equal the number of bands or be empty, default = none
colors: list
A list of color values that should either equal the number of bands or be a single color, (purple = default)
cols: int
The number of columns you want to plot in
bins: int
The number of bins to calculate for the histogram
figsize: tuple
The figsize if you'd like to define it. default: (12, 12)

The hist() function returns the following:

fig, ax or axs : figure object, axes object
The figure and axes object(s) associated with the histogram.

Example:

.. code-block:: python

import earthpy.spatial as es

colors = ['r', 'k', 'b', 'g', 'k', 'y', 'y']
titles = ["Red Band", "Near Infrared (NIR) Band", "Blue/Green Band",
             "Green Band", "Near Infrared (NIR) Band",
             "Mid-infrared Band", "Mid-infrared Band"]

# Plot histogram
es.hist(modis_bands_pre_data,
            colors=colors,
            title=titles,
            cols=2)

Add data to unit test folder

Currently we do'nt have any data to implement unit testing on. However given the nature of the packages that we are using, we should have some data to test against. Let's follow the rasterio model and add a small data subset to be used to testing purposes in earthpy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.