Initial commit

This commit is contained in:
2026-04-10 16:46:45 +08:00
commit 4fd1b0a203
165 changed files with 25698 additions and 0 deletions

View File

@ -0,0 +1 @@
adam@adams-mbp.russell.wisc.edu.34021

View File

@ -0,0 +1,10 @@
---
# Only the main Sass file needs front matter (the dashes are enough)
---
@import "minimal-mistakes/skins/{{ site.minimal_mistakes_skin | default: 'default' }}"; // skin
@import "minimal-mistakes"; // main partials
html {
font-size: 16px; // change to whatever
}

View File

@ -0,0 +1 @@
.beer-slider{display:inline-block;overflow:hidden;position:relative}.beer-slider *,.beer-slider:after,.beer-slider :after,.beer-slider:before,.beer-slider :before{box-sizing:border-box}.beer-slider img,.beer-slider svg{vertical-align:bottom}.beer-slider>*{height:100%}.beer-slider>img{height:auto;max-width:100%}.beer-reveal{left:0;opacity:0;overflow:hidden;position:absolute;right:50%;top:0;transition:opacity .35s;z-index:1}.beer-reveal>:first-child{height:100%;max-width:none;width:200%}.beer-reveal>img:first-child{height:auto}.beer-range{-moz-appearance:none;-ms-touch-action:auto;-webkit-appearance:slider-horizontal!important;bottom:0;cursor:pointer;height:100%;left:-1px;margin:0;opacity:0;position:absolute;top:0;touch-action:auto;width:calc(100% + 2px);z-index:2}.beer-range::-webkit-slider-thumb{-webkit-appearance:none;height:300vh}.beer-range::-moz-range-thumb{-webkit-appearance:none;height:300vh}.beer-range::-ms-tooltip{display:none}.beer-handle{background:hsla(0,0%,100%,.5);border-radius:50%;box-shadow:0 0 6px transparent;color:#000;height:48px;left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate3d(-50%,-50%,0);transition:background .3s,box-shadow .3s,opacity .5s .25s;width:48px;z-index:2}.beer-handle:after,.beer-handle:before{border-left:2px solid;border-top:2px solid;content:"";height:10px;position:absolute;top:50%;transform-origin:0 0;width:10px}.beer-handle:before{left:10px;transform:rotate(-45deg)}.beer-handle:after{right:0;transform:rotate(135deg)}.beer-range:focus~.beer-handle{background:hsla(0,0%,100%,.85);box-shadow:0 0 3px rgba(0,0,0,.4)}.beer-reveal[data-beer-label]:after,.beer-slider[data-beer-label]:after{background:hsla(0,0%,100%,.75);border-radius:.125rem;content:attr(data-beer-label);line-height:1;padding:.5rem;position:absolute;top:1.5rem}.beer-slider[data-beer-label]:after{right:1.5rem}.beer-reveal[data-beer-label]:after{left:1.5rem}.beer-reveal[data-beer-label=""]:after,.beer-slider[data-beer-label=""]:after{content:none}.beer-ready .beer-handle,.beer-ready .beer-reveal{opacity:1}

Binary file not shown.

After

Width:  |  Height:  |  Size: 313 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 KiB

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,22 @@
.. _algorithms:
==================
Advanced use
==================
Spectrum resampling
===================
.. todo:: Spectrum resampling example script
Topographic correction
======================
.. todo:: Topographic correction example script
BRDF correction
===============
.. todo:: BRDF correction example script

View File

@ -0,0 +1,141 @@
.. _basics:
===========
Basic use
===========
Loading images
==============
HyTools includes options for loading both ENVI formatted binary files, NASA NetCDF files,
and NEON AOP HDF files.
.. code-block:: python
import hytools as ht
#Create a HyTools container object
envi = ht.HyTools()
#Read and load file metadata
envi.read_data('./envi_file.bin',file_type= 'envi')
For reading NEON data the process is the same:
.. code-block:: python
#Load an NEON HDF image
neon = ht.HyTools()
neon.read_data("./neon_file.h5",'neon')
Reading data
============
There are several ways to read data using a :class:`~hytools.base.HyTools` object. One option
is to use one of the 'get' methods:
.. code-block:: python
wave = neon.get_wave(900)
band = neon.get_band(10)
column = neon.get_column(1)
line = neon.get_line(234)
chunk = neon.get_chunk(x1,x2,y1,y2)
pixels = neon.get_pixels([0,1,2],[3,4,5])
We can also retrieve masked data, where a binary mask is used to
return a subset of the data. Currently masking only works using the
:meth:`~hytools.base.HyTools.get_band` or
:meth:`~hytools.base.HyTools.get_wave` methods. First we need to
generate a mask, which can be done using the
:meth:`~hytools.base.HyTools.gen_mask` method.
.. code-block:: python
# NDVI masking function
def masker(hy_obj):
ir = hy_obj.get_wave(900)
red = hy_obj.get_wave(660)
ndvi = (ir-red)/(ir+red)
return ndvi > .5
# Generate mask
neon.gen_mask(masker)
# Retrieve pixels where mask is True
pixels = neon.get_band(100, mask_values = True)
Alternatively an :class:`~hytools.base.Iterator` can be used to cycle along a
specified axis of the dataset either by line, column, band or
chunk. This is useful for cycling through and image, applying
a function/algorithm and then writing to a file.
.. code-block:: python
iterator = hy_obj.iterate(by = 'line')
Next cycle through the image line by line until complete:
.. code-block:: python
while not iterator.complete:
line = iterator.read_next()
Writing data
============
Currently writing is only supported for ENVI files and NetCDF files, however data from
NEON hdf files can be easy written to ENVI format using builtin
functions.
First an ENVI header dictionary needs to be generated to specify the
file size, datatype, interleave and other relevant metadata. This is
done using the :func:`~hytools.io.envi.envi_header_from_hdf` function.
.. code-block:: python
header_dict = envi_header_from_hdf(neon)
In this case we are going to export an RGBI image so we need to update
the number of bands:
.. code-block:: python
head_dict['bands'] = 4
Next we create an :class:`~hytools.io.envi.WriteENVI` object which
generates the header and image file using the specifications in the
header dictionary:
.. code-block:: python
output_name = './neon.bin'
writer = WriteENVI(output_name,header_dict)
Finally we can write the bands to file. First we retrieve the closest
wavelength to each input wavelength using the
:meth:`~hytools.base.HyTools.get_wave` method, next we write the band
to the new file with the :meth:`~hytools.io.envi.WriteENVI.write_band`
method.
.. code-block:: python
for band_num,wavelength enumerate([660,550,440,880]):
wave = neon.get_wave(wavelength)
writer.write_band(wave,band_num)
writer.close()

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

View File

@ -0,0 +1,35 @@
.. _command:
====================
Command line tools
====================
image_correct.py
================
The 'image_correct' script is a general purpose tool that utilizes
topographic, BRDF and wavelength resampling fuctions to modify/correct
an image.
Configuration file
------------------
Image correction options are specified using a JSON file. Example
configuration files can be found in the github repository. We
have also created a script to automatically generates a JSON
configuration file.
trait_estimate.py
=================
The 'trait_estimate.py' script is a tool to generate maps of canopy
foliar traits given a set of model parameters. Currently only PLSR
models are supported, however support for other statistical modeling
frameworks like Gaussian process regression is currently under
development.

View File

@ -0,0 +1,74 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
# sphinx-apidoc -f -o source/ ../hytools
#
import os
import sys
import sphinx_rtd_theme
sys.path.insert(0, os.path.abspath('..'))
# -- Project information -----------------------------------------------------
project = 'HyTools'
copyright = '2020, Adam Chlus, Zhiwei Ye, Philip Townsend'
author = 'Adam Chlus'
# The full version, including alpha/beta/rc tags
release = '0.0.1'
html_static_path = ['_static']
html_css_files = [
'css/slider.css',
]
html_js_files = [
'js/slider.js',
]
# -- General configuration ---------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.napoleon',
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.coverage',
'sphinx_rtd_theme',
'sphinx.ext.todo'
]
todo_include_todos=True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
master_doc = 'index'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

View File

@ -0,0 +1,50 @@
About HyTools
=====================
HyTools is a python library for processing airborne and spaceborne
imaging spectroscopy data, with a focus on terrestrial scenes. At it's
core it consists of functions for reading and writing `ENVI
<https://www.l3harrisgeospatial.com/docs/ENVIImageFiles.html>`_
formatted images and reading `NEON AOP
<https://www.neonscience.org/data-collection/airborne-remote-sensing>`_
HDF files along with a series of image processing functions including
spectral resampling, topographic and BRDF correction, spectral
transforms, masking and more. We have also created a series of command
line tools which combine these functions and provide a streamlined
workflow for processing images.
Examples
--------
BRDF correction
~~~~~~~~~~~~~~~
.. raw:: html
<embed>
<link rel="stylesheet" href="/_static/css/slider.css">
<script src="/_static/js/slider.js" type="text/javascript" ></script>
<div id="slider" class="beer-slider" data-beer-label="">
<img src="/_static/images/research/3d_rgb.jpg" alt="">
<div class="beer-reveal" data-beer-label="">
<img src="/_static/images/research/rgb_rgb.jpg" alt="">
</div>
</div>
<script type="text/javascript">
new BeerSlider(document.getElementById('slider'));
</script>
</embed>
.. image:: brdf_before_after.png
Topographic correction
~~~~~~~~~~~~~~~~~~~~~~
.. image:: topo_correct.gif

View File

@ -0,0 +1,29 @@
hytools.correction package
==========================
Submodules
----------
hytools.correction.brdf module
------------------------------
.. automodule:: hytools.correction.brdf
:members:
:undoc-members:
:show-inheritance:
hytools.correction.topo module
------------------------------
.. automodule:: hytools.correction.topo
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hytools.correction
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,37 @@
hytools.io package
==================
Submodules
----------
hytools.io.envi module
----------------------
.. automodule:: hytools.io.envi
:members:
:undoc-members:
:show-inheritance:
hytools.io.neon module
----------------------
.. automodule:: hytools.io.neon
:members:
:undoc-members:
:show-inheritance:
hytools.io.netcdf module
----------------------
.. automodule:: hytools.io.netcdf
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hytools.io
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,21 @@
hytools.misc package
====================
Submodules
----------
hytools.misc.misc module
------------------------
.. automodule:: hytools.misc.misc
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hytools.misc
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,32 @@
hytools package
===============
Subpackages
-----------
.. toctree::
:maxdepth: 4
hytools.correction
hytools.io
hytools.misc
hytools.transform
Submodules
----------
hytools.base module
-------------------
.. automodule:: hytools.base
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hytools
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,29 @@
hytools.transform package
=========================
Submodules
----------
hytools.transform.mnf module
----------------------------
.. automodule:: hytools.transform.mnf
:members:
:undoc-members:
:show-inheritance:
hytools.transform.resampling module
-----------------------------------
.. automodule:: hytools.transform.resampling
:members:
:undoc-members:
:show-inheritance:
Module contents
---------------
.. automodule:: hytools.transform
:members:
:undoc-members:
:show-inheritance:

View File

@ -0,0 +1,12 @@
HyTools Documentation
=====================
.. toctree::
:maxdepth: 2
contents
installation
basics
algorithms
command_line
modules

View File

@ -0,0 +1,29 @@
.. _install:
=============
Installation
=============
Dependencies
============
* numpy
* h5py
* ray
Installing HyTools
==================
To download to hytools simply clone the github repository
.. code-block:: shell
$ git clone https://github.com/EnSpec/hytools.git
and run the following command inside the hytools folder to install
.. code-block:: shell
$ python setup.py install

View File

@ -0,0 +1,7 @@
hytools
=======
.. toctree::
:maxdepth: 4
hytools

View File

@ -0,0 +1 @@
sphinx_rtd_theme

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB