Unsupervised Land Cover Classification with Python
| | |

Unsupervised Land Cover Classification with 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…

Parallel Programming in Python with Message Passing Interface (mpi4py)
| | | |

Parallel Programming in Python with Message Passing Interface (mpi4py)

Did you know you can write parallel Python code that will run on your laptop and on a super computer? You can, and it’s not as difficult as you might expect. If you already write code for asynchronous parallelization then you won’t even have to do much restructuring. High Performance Computing (HPC) distributes pieces of jobs across…

Asynchronous Parallel Programming in Python with Multiprocessing
| |

Asynchronous Parallel Programming in Python with Multiprocessing

A flexible method to speed up code on a personal computer Do you wish your Python scripts could run faster? Maybe they can. And you won’t (probably) have to buy a new computer, or use a super computer. Most modern computers contain multiple processing cores but, by default, python scripts only use a single core….

|

R: Save NetCDF as a CSV

Sometimes certain analysis may require data in a tabular format (as opposed to the gridded format of NetCDF). This tutorial will take you through how to convert a NetCDF (or other raster/gridded data) to an R data frame, which can then used for analysis or saved as a CSV file. Read the NetCDF file First,…

|

numpy: Methods For Creating Arrays

It is tedious, and not practical, to manually type in values for array creation. In this tutorial we will go through methods for automating array creation and importing tabular data into numpy arrays. Creating empty arrays With numpy you don’t actually create an ‘empty’ array. But you can create an array without intializing specific values. This can be useful…

|

numpy: Array shapes and reshaping arrays

We’ve gone through the basics to manually create arrays of different dimensions and shapes. There will be times that you will want to query array shapes, or automatically reshape arrays. This tutorial will show you how to use numpy.shape and numpy.reshape to query and alter array shapes for 1D, 2D, and 3D arrays. Different methods are required to find…

|

numpy: Creating Arrays

Creating a simple array After numpy is installed, we can begin to create arrays. First, we’ll need to import numpy into our python project. Here I use the statement, import numpy as np, to limit my typing later. This code will allow me to use np in my script to represent instead of typing the full numpy everytime. Then, we can create a simpy…

|

numpy: Install numpy

Check Installation First, check to see if you already have numpy installed. From the terminal, you can use pip to do this. If numpy is installed you will get output similar to this. If numpy is not installed no output will be shown. Install numpy numpy can be installed simply using pip. Check version You can check the numpy version using pip show as demonstrated above. Video tutorial This…

|

numpy: Introduction to numpy

Requirements: Python version 2.7 or greater Beginner skills with python Desire to learn numpy Objectives: Teach the basics of using numpy in python Provide data science applications of numpy Introduce advanced numpy concepts What is numpy? numpy is a powerful python package for handling arrays. It uses C libraries to optimize procedures that would otherwise be slow/computationally expensive in python. What can I do…

|

R: Get data from a NetCDF

List the data attributes Accessing the var property of our netCDF varialbe will list the data attributes for the netCDF file. The output shows us this dataset has one data attribute with the name ‘data’. Which is contained within the names property of var. Calling the names property directly after the attributes() call gives the same result. We can get the name of specific…