X

NV5 Geospatial Blog

Each month, NV5 Geospatial posts new blog content across a variety of categories. Browse our latest posts below to learn about important geospatial information or use the search bar to find a specific topic or author. Stay informed of the latest blog posts, events, and technologies by joining our email list!



Mapping Earthquake Deformation in Taiwan With ENVI

Mapping Earthquake Deformation in Taiwan With ENVI

12/15/2025

Unlocking Critical Insights With ENVI® Tools Taiwan sits at the junction of major tectonic plates and regularly experiences powerful earthquakes. Understanding how the ground moves during these events is essential for disaster preparedness, public safety, and building community resilience. But traditional approaches like field... Read More >

Comparing Amplitude and Coherence Time Series With ICEYE US GTR Data and ENVI SARscape

Comparing Amplitude and Coherence Time Series With ICEYE US GTR Data and ENVI SARscape

12/3/2025

Large commercial SAR satellite constellations have opened a new era for persistent Earth monitoring, giving analysts the ability to move beyond simple two-image comparisons into robust time series analysis. By acquiring SAR data with near-identical geometry every 24 hours, Ground Track Repeat (GTR) missions minimize geometric decorrelation,... Read More >

Empowering D&I Analysts to Maximize the Value of SAR

Empowering D&I Analysts to Maximize the Value of SAR

12/1/2025

Defense and intelligence (D&I) analysts rely on high-resolution imagery with frequent revisit times to effectively monitor operational areas. While optical imagery is valuable, it faces limitations from cloud cover, smoke, and in some cases, infrequent revisit times. These challenges can hinder timely and accurate data collection and... Read More >

Easily Share Workflows With the Analytics Repository

Easily Share Workflows With the Analytics Repository

10/27/2025

With the recent release of ENVI® 6.2 and the Analytics Repository, it’s now easier than ever to create and share image processing workflows across your organization. With that in mind, we wrote this blog to: Introduce the Analytics Repository Describe how you can use ENVI’s interactive workflows to... Read More >

Deploy, Share, Repeat: AI Meets the Analytics Repository

Deploy, Share, Repeat: AI Meets the Analytics Repository

10/13/2025

The upcoming release of ENVI® Deep Learning 4.0 makes it easier than ever to import, deploy, and share AI models, including industry-standard ONNX models, using the integrated Analytics Repository. Whether you're building deep learning models in PyTorch, TensorFlow, or using ENVI’s native model creation tools, ENVI... Read More >

1345678910Last
«January 2026»
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
12155 Rate this article:
4.0

Increasing Performance when Assigning Subsets of Arrays

Anonym

When working with multi-dimensional data, as is the case with images, it is sometimes necessary to replace a chunk of data with another chuck of the same size. With images, this could be a spatial area that needs to be replaced because of clouds, or a spectral band that needs to be replaced.

In the case of a spatial replacement, say we want to replace a section of data with an array of the same size. For this example, the subset is 50 rows and 50 columns, and the larger data is 250 rows, and 250 columns.

IDL> array = bytarr(250, 250) + 127B

IDL> sub = indgen(50, 50)

To replace a section of data in IDL, one might go about itthis way:

IDL> array[50:99, 100:149] = sub

This is an acceptable method, but it is not the faster way of doing this. With the method of replacement done above, IDL will replace each individual element one at a time. To replace the entire subset at once, IDL only requires the first index where the subset needs to be inserted:

IDL> array[50, 100] = sub

IDL will fill in data until the entirety of the subset is in the larger data. Do be cautious though, if you run out of room IDL will either give unexpected results, or throw and out-of-bounds error. Here is the image of the array we just manipluated:

IDL> i = image(array)


An Array Within an Array

The advantage though, is that this is much faster than explicitly calling out the array elements to replace, or using a wildcard (*) character. Let's take a look at using wildcard characters for the next example - replacing a band.

If we wanted to take an image, and decrease the amount of red in that image, we could do that by multiplying the red band by a number smaller than one. First, let's get some image data:

IDL> file = file_which('rose.jpg')

IDL> read_jpeg, file, data

IDL> help, data

DATA           BYTE      = Array[3, 227, 149]

In order to get the red band we will have to use wildcards. However, this will not be a performance issue, as we are assigning a chuck of data to a variable. Nothing is being replaced. As a good rule of thumb, it is best to avoid using wildcards on the left-hand side of an assignment when possible, but wildcards on the right-hand side of an assignment are okay.

IDL> red = data[0,*,*]

Now let's assign the old red band to the original multiplied by 0.6. We could use wildcards again to do this:

IDL> data[0,*,*]= byte(red * 0.6)

But we now know that this is not the most efficient way to assign this band in IDL. It only needs the first index of the data that we want to replace:

IDL> data[0,0,0] = byte(red* 0.6)

Because the red band is still the same size, the entire band will be replaced all at once instead of one element at a time. For these small arrays, the speed increase is not huge, but with larger datasets, it becomes important to use this practice to achieve high levels of performance.

IDL> i = image(data)


Please login or register to post comments.