NumPy is a fundamental module used in many Python programs and analyses because it conducts numerical computations very efficiently. However, for those new to NumPy, it can be difficult to grasp at first. Specifically, understanding array indexing and sorting quickly becomes complex. Fortunately, NumPy has some built-in functions that make performing basic sorting operations quite simple.
NumPy arrays can be sorted by a single column, row, or by multiple columns or rows using the
argsort() function. The
argsort function returns a list of indices that will sort the values in an array in ascending value. The
kind argument of the…
False-color satellite images can be very useful to visually analyze different landscape characteristics. They also look really cool and are used to make very artistic maps and displays.
False-color satellite images are created by displaying different band combinations with different colors. For example, a color near-infrared image is created by displaying data from the near-infrared sensor as red, data from the red sensor as green, and data from the green sensor as blue.
Color near-infrared is commonly used to show areas that are vegetated and areas that are covered by water (see image below). Vegetation reflects near-infrared (NIR) light and…
Vegetation indices are a staple remote sensing product and the normalized difference vegetation index (NDVI) may be the most widely used vegetation index. To calculate NDVI you simply need appropriate imagery and a program that allows you to interact with the image data. QGIS is a great, free option for a GIS program that provides the tools to display, analyze and present remotely-sensed data.
It is very easy to calculate NDVI in QGIS using the QGIS raster calculator. All you need is imagery that contains red and near-infrared bands and QGIS installed on your machine. …
There’s a good chance you’ve done something today that used a sliding window (also known as a moving window) and you didn’t even know it. Have you done any photo editing? Many editing algorithms are based on moving windows. Do you do terrain analysis in GIS? Most topographic raster metrics (slope, aspect, hillshade, etc.) are based on sliding windows. Anytime you do analysis on data formatted as a two-dimensional array there’s a good chance a sliding window will be involved.
Sliding window operations are extremely prevalent and extremely useful. They’re also very easy to implement in Python. …
When you work with spatial data, it’s inevitable that you will need to implement information from both a vector and raster data source for the same location. This task can easily be accomplished manually, but it often becomes quite cumbersome when the process must be automated across a large number of features, time periods, and/or datasets. Discrete, irregularly shaped polygons do not always play nice with structured, rectangular grids.
It is a common need to summarize information from a gridded dataset within an irregularly shaped area. While at first glance this may seem simple, reconciling differences between raster (gridded) and vector (polygon) datatypes can quickly become complicated. This article shows how to implement a zonal statistics algorithm in Python in 4 steps.
Start by importing the necessary Python modules.
Now set the file paths for the raster and vector data and use
Everyone is good at something. With creativity and determination (and maybe some marketing) others will pay to learn from you. Teaching online courses is a great way to earn passive income. The barriers for entry are low, and if your online course doesn’t pan out, the only thing you’ll lose is time.
Chances are, you’ll be surprised by the number of people that are interested in your course. I create Geographic Information System (GIS) courses, which is a fairly narrow niche. There are only three course offerings on my website, but I still make enough to pay for all my…
Gridded, spatial data are commonly stored in NetCDF files. This is especially true for climate data. NetCDF files offer more flexibility and transparency than some traditional raster formats by supporting multiple variables and detailed metadata. Because of the metadata and file structure NetCDF files can be more difficult to access than traditional raster formats. This article addresses the basics of creating a NetCDF file and writing data values in Python. I previously wrote about accessing metadata and variables from a NetCDF file with Python.
numpy modules. Then define a file name with the
Network common data form (NetCDF) is commonly used to store multidimensional geographic data. Some examples of these data are temperature, precipitation, and wind speed. Variables stored in NetCDF are often measured multiple times per day over large (continental) areas. With multiple measurements per day, data values accumulate quickly and become unwieldy to work with. When each value is also assigned to a geographic location, data management is further complicated. NetCDF provides a solution for these challenges. This article will get you started with reading data from NetCDF files using Python.
NetCDF files can be read with a few different Python…
Aerial imagery is used for purposes ranging from military actions to checking out the backyard of a house you might buy. Our human brains can easily identify features in these photographs, but it’s not as simple for computers. Automated analysis of aerial imagery requires classification of each pixel into a land cover type. In other words, we must train a computer to know what it’s looking at, so it can figure out what to look for.
There are two primary classification methods. Supervised and unsupervised. Supervised classification uses observed data to teach an algorithm which combinations of red, green, and…