Skip to content

Commit

Permalink
Adding Youtube video, and some PEP8 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jordancaraballo committed Oct 6, 2023
1 parent 1232add commit 3e11390
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 48 deletions.
20 changes: 9 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,10 @@ Teams' Validation Example on the Science Managed Cloud Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The following is an example workflow using the Science Managed Cloud Environment. Depending on your environment,
you will need to modify some of these steps.
you will need to modify some of these steps. If you have been notified that a tutorial environment is already
generated for you, feel free to skip to step 3.

If you have been notified that a tutorial environment is already generated for you, feel free to skip to step 3.

#. Setup the working environment - Only done by the Team Administrator
**1. Setup the working environment - Only done by the Team Administrator**

For this first step we will setup the working directories for your team. In this case we need 3 main directories.
When using the Daskhub system, we have a directory called /home/jovyan, which is your personal home directory. Then
Expand All @@ -219,27 +218,26 @@ setup your Daskhub working environment.
wget https://raw.githubusercontent.com/nasa-nccs-hpda/eo-validation/main/notebooks/ValidationEnvironmentSetup.ipynb
Then, we will setup our data, labels, and original points directories:

.. code:: bash
mkdir -p /efs/projects/<project_name>/data /efs/projects/<project_name>/labels /efs/projects/<project_name>/validation/original_points
#. Upload the data to your system of choice - Only done by the Team Administrator
**2. Upload the data to your system of choice - Only done by the Team Administrator**

In this step you will need to upload the data you will be using in the validation exercise. In general this will require
you to upload a pair of data (GeoTIFF satellite imagery) and labels (GeoTIFF single band label), and locate them in a
general location. To upload the data to SMCE, you can use scp from a terminal within Daskhub, or manually uploading the
imagery using Drag and Drop options.

#. Start working on your environment
**3. Start working on your environment**

In this step users can start working on their personal notebooks. These notebooks can be accessed by opening the
ValidationDashboard.ipynb file from your working directory. For example, if you are part of Dr. Peng group, you can
access your personal tutorial notebook under /efs/Bin_UIUC/<your_username>/ValidationDashboard.ipynb.

If you need additional help walking through the notebook, here is a short video on how to get started `YouTube <https://youtu.be/3tG7bQ-10ac>`__.

.. image:: https://img.youtube.com/vi/3tG7bQ-10ac/maxresdefault.jpg
:alt: eo-validation demo
:target: https://www.youtube.com/watch?v=3tG7bQ-10ac

Overall Validation Workflow
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
28 changes: 1 addition & 27 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import os
import sys

sys.path.insert(0, os.path.abspath('..'))

import eo_validation

# package_path = os.path.abspath('..')
# os.environ['PYTHONPATH'] = ':'.join((package_path, os.environ.get('PYTHONPATH', '')))

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'eo-validation'
copyright = '2023, Jordan A. Caraballo-Vega'
author = 'Jordan A. Caraballo-Vega'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'sphinx.ext.autodoc',
'sphinx_autodoc_typehints',
Expand All @@ -46,23 +33,10 @@
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

#source_suffix ={
# '.rst': 'restructuredtext',
# '.txt': 'markdown',
# '.md': 'markdown',
# '.ipynb': 'myst-nb'
#}
master_doc = "index"

version = release = eo_validation.__version__

pygments_style = "sphinx"

todo_include_todos = False

html_theme = 'sphinx_rtd_theme'

# html_static_path = ['_static/']
Expand All @@ -74,4 +48,4 @@
"dollarmath",
"html_image",
]
myst_url_schemes = ("http", "https", "mailto")
myst_url_schemes = ("http", "https", "mailto")
2 changes: 1 addition & 1 deletion eo_validation/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__author__ = """Jordan A. Caraballo-Vega"""
__email__ = "jordan.a.caraballo-vega@nasa.gov"
__version__ = "0.0.1"
__version__ = "0.1.1"
23 changes: 14 additions & 9 deletions eo_validation/validation_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ def generate_points(
# Make sure expected accuracies match size of classes found
if len(self.expected_accuracies) != raster_prediction['predicted'].max() + 1:
self.expected_accuracies = \
[self.expected_accuracies[0]] * (raster_prediction['predicted'].max() + 1)
[self.expected_accuracies[0]] * \
(raster_prediction['predicted'].max() + 1)

print("self.expected_accuracies", self.expected_accuracies)
print("unique_counts", unique_counts)
Expand Down Expand Up @@ -336,8 +337,9 @@ def generate_points(
if unique_counts['n_point'].sum() < val_total_points:
unique_counts.at[0, 'n_point'] += \
val_total_points - unique_counts['n_point'].sum()
elif unique_counts['n_point'].sum() > val_total_points:
unique_counts.at[unique_counts['n_point'].idxmax(), 'n_point'] -= \
elif unique_counts['n_point'].sum() > val_total_points:
unique_counts.at[
unique_counts['n_point'].idxmax(), 'n_point'] -= \
unique_counts['n_point'].sum() - val_total_points

for class_id, row in unique_counts.iterrows():
Expand All @@ -362,8 +364,10 @@ def generate_points(
# Convert to dataframe and filter no-data
raster_prediction = \
raster_prediction.squeeze().to_dataframe().reset_index()

# drop some unecessary columns
raster_prediction = raster_prediction.drop(
['band', 'spatial_ref'], axis=1) # drop some unecessary columns
['band', 'spatial_ref'], axis=1)

# Only select appropiate values, remove no-data
raster_prediction = raster_prediction[
Expand All @@ -373,7 +377,7 @@ def generate_points(
raster_prediction = raster_prediction.astype({'predicted': 'int'})

# Generate random points (drop randomly from the dataset
raster_prediction = raster_prediction.sample(n = n_points)
raster_prediction = raster_prediction.sample(n=n_points)

# Generate geometry dataframe
geometry = gpd.points_from_xy(raster_prediction.x, raster_prediction.y)
Expand All @@ -400,15 +404,15 @@ def add_markers(
mask_filename = mask_filename[0]
else:
mask_filename = None

original_points_filename = os.path.join(
self.points_dir, f'{Path(in_raster).stem}.gpkg')

# Extract output filename if None available and doing offline points
if self.output_filename is None or offline:
self.output_filename = os.path.join(
self.output_dir, f"{Path(in_raster).stem}.gpkg")

# Case #1: student is already working on the points
if not gen_points or os.path.isfile(self.output_filename):
validation_points = self.load_gpkg(self.output_filename)
Expand Down Expand Up @@ -515,7 +519,8 @@ def add_markers(
cell = ipysheet.cell(index, 3, point['burnt'])
widgets.jslink((cell, 'value'), (radio_burn_widget, 'value'))
cell = ipysheet.cell(index, 4, point['confidence'])
widgets.jslink((cell, 'value'), (radio_confidence_widget, 'value'))
widgets.jslink(
(cell, 'value'), (radio_confidence_widget, 'value'))
cell = ipysheet.cell(index, 5, verified_option)
widgets.jslink((cell, 'value'), (checked_widget, 'value'))

Expand Down

0 comments on commit 3e11390

Please sign in to comment.