Skip to main content
U.S. flag

An official website of the United States government

National Agricultural Imagery Program Prep Imagery Rescaler Help


NPI Rescaler User Guide (PDF, 340 KB)

Overview


This NAIP Prep Imagery (NPI) Rescaler application increases the cell size on each of the bands of a Native Naip Scale (NNS) NPI model output image. A larger cell size makes an image that is smaller in file size which can facilitate transport to another cloud or disk.

This NPI Rescaler application rescales NNS to a reduced (i.e. coarser) resolution after NPI is run. As a result, producing a reduced resolution image is a two-step process. However, rescaling runs quickly because it doesn’t have to run the model and compute the image like NPI.

The user interface is a series of steps that are used to help setup a rescaling. The Graphical User Interface (GUI) serves the purpose of gathering parameters to send to the processing software.

The application is a Single Page Application (SPA) reactive GUI that allows for a better User eXperience (UX) where parts of the interface are updated without a sequence of screens.

This application is run in the Google Earth Engine (GEE) site at code.earthengine.google.com. GEE is a web-based Interactive Development Environment (IDE) for the Earth Engine JavaScript API. GEE code editor features are designed to make developing complex geospatial workflows fast and easy.

The GEE site also features a large set of geospatial data and a repository for user created data. The site automatically brings more servers into service as needed without any coding.

The objective of this document is to introduce and describe the use of the Forest Health NPI Rescaler application in GEE. The application’s purpose will help to minimize any ‘behind the scenes work’ in the GEE script window and to allow for more defined adjustments and protocols for obtaining model results.

Acronyms and Abbreviations


ABBREVIATIONACRONYM
FAQFrequently asked questions
FHAASTForest Health Assessment and Applied Science Team
GEEGoogle Earth Engine
GUIGraphical User Interface
NAIPNational Agricultural Imagery Program
NNSNAIP Native Scale
NPINAIP Prep Imagery
SPASingle Page Application
UXUser eXperience

Contents


The purpose of this code is to gather parameters and select imagery for input into the rescaling which outputs the NNS asset to permanent storage at a reduced scale.

1-Select State, Year and Asset


The NPI application outputs NNS bioclimatic model imagery for a state and year. These options identify that imagery to be rescaled.

Select State, Year, Asset user interface

Click the ‘Select a value’ box to choose the state for which the imagery was generated.  Selecting a state will zoom to the state and center the map in the map window. In addition, selecting a state populates the NAIP Year and NNS Asset select lists.

After selecting a state, click a NAIP Year to select one of the available years for the state. The most recent year is the first choice in the descending ordered list. The year may show as a negative value when another state is selected with the same most recent year. The negative sign is only to trigger an on-change event to generate a new NNS asset list.

Selecting a year refreshes the list of assets for the state and year. The asset names are sorted by most recent and are selected as the first available choice.

2-Prep Imagery Info


The desired scale or cell size is captured in this section.

Select cell size slider user interface

SCALE

The scale for the output imagery is set on the slider to establish the cell size for the reduced resolution output map. The value selected on the slider is included in the output file name. FHAAST uses standard snap grids at 30, 240, 480, 960, and 1920 m. When a scale that is coarser than NNS is used, it will typically be set to the 30 meter maximum.

The selected scale image has cell values of zero to one hundred for each of the five bands. The value is the percentage of the cell that has the particular color. Scales of three or greater average the NNS cells to produce the percentage value in the reduced resolution image.

3-Produce Results


In this section the output image is generated with the parameters that have been set.

Run Rescale User Interface

When the Run Rescale button is used, the output reduced resolution image is generated. The name is the same as the NNS image with the characters ‘nns’ replaced by the scale value.

3.1-Notes Before Running

The next steps are outside the GUI and are a bit awkward. The Forest Service has asked GEE for a function to replace these steps. Meanwhile the steps are the following:

  • Click show code or drag the bar above the map to reveal the ‘Tasks’ tab at the top right.
    GEE Tasks tab and sizeable dropdown interface.

  • Click ‘Run’ box to the right of the saved file.
    The run buttons highlights how to initiate the task export.

  • Click ‘Run’ button on the displayed panel.

Running the task can require a lot of time to complete-from seconds to hours to days. While running, a spinning cog icon will rotate to the right of the export file name followed by the amount of time the task has been running. The export file name will be highlighted in blue when the task is finished. It is safe to exit the application while the task is running. Once the task is complete, the file will be shown in the ‘Assets’ tab. It’s best to limit the number of tasks that are running all at the same time. This can prolong completion time.

FAQ's

When a different state is selected that has the same most recent year a negative sign is placed on the choice so that the on-change event can fire and update the assets list. This possibly occurs when selecting a different state with the same most recent year in the same session.

Scaling to 240 isn’t currently possible. 240 results in the following error:

Error from rescale
Google has been contacted to help resolve the problem.

The purpose of this application is to run the rescaling operation. The result can be viewed in npiAssetsViewer when the task completes.