For convenience, I have included a check in my example scripts for an environment variable called “DS_WORKSPACE” that is used for reading from and saving to a designated workspace folder on your computer. If this variable does not exist, the scripts assume you want to read and write to the working folder (i.e., the same folder that your script lives in). To create and define your workspace folder, please follow these instructions.
DS_WORKSPACE
Run the following command in the terminal or save it to your ~/.bash_profile
to run it every time you open a terminal.
export DS_WORKSPACE=~/Workspace
Python wheel files (.whl) are the new distribution standard for Python packages. You may come across wheel files (especially those of you trying to install numpy on Windows) because they can come with precompiled C code, which you would otherwise have to compile on your machine. You can install a .whl package using pip.
For example, download a wheel package (“package-0.10.2-cp37-cp37m-win_amd64.whl”), open a terminal and cd
to folder where it was downloaded, and run pip install package-0.10.2-cp37-cp37m-win_amd64.whl
.
In order for images to appear on your web page that is rendered from markdown, you need a publicly accessible URL for the image.
Two popular cloud-based storage options are Dropbox and Google Drive. You may also find public domain or CC-BY-SA images on Wikimedia Commons. If you want to access images that are saved in one of these locations, try the steps outlined below.
?dl=0
to ?raw=1
![Example link to image stored on Dropbox.](https://www.dropbox.com/s/pqtsip7582dc3bk/logo.png?raw=1){width=150 height=150}
/file/d
and before the /view?
in the URL (i.e., 11YjM3ua8DXZvhhfEFaG1LPUupnoj2qB4
from the example URL above).https://drive.google.com/uc?export=view&id=
and append the file ID at the end.![Example link to image stored in Drive](https://drive.google.com/uc?export=view&id=11YjM3ua8DXZvhhfEFaG1LPUupnoj2qB4){width=150 height=150}
![Example link to image stored on Wikimedia](https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Albert_Einstein_Head.jpg/180px-Albert_Einstein_Head.jpg)
Do you dread making tables in markdown? Try using an R data frame and let knitr do the work for you! Here’s an example R code chunk and the web table it produces:
library(knitr)
data.frame(
my.data <-months = c("Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
days_in_month = c(31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31)
)::kable(my.data, col.names = c("Months", "Number of Days")) knitr
Months | Number of Days |
---|---|
Jan | 31 |
Feb | 28 |
Mar | 31 |
Apr | 30 |
May | 31 |
Jun | 30 |
Jul | 31 |
Aug | 31 |
Sep | 30 |
Oct | 31 |
Nov | 30 |
Dec | 31 |
More on R’s data.frame object can be found here.
https://pro.arcgis.com/en/pro-app/arcpy/get-started/what-is-conda.htm
...\Program Files\ArcGIS\Pro\bin\Python\Scripts\
activate sdd
Based on Davis’s MODIS EVI example using GIMP and FFmpeg (FFmpeg installed with Imagemagick).
Load spatial data into QGIS
Load images into GIMP
r
) to draw a box around what you want, then use Image → Crop to Selection)Save your layers as an animated GIF (Export → GIF)
From the command line, convert exported GIF to video format (reference)
Update the -i
input file name and .mp4
output file name
ffmpeg -f gif -i Untitled.gif -pix_fmt yuv420p -c:v libx264 -movflags +faststart -filter:v crop='floor(in_w/2)*2:floor(in_h/2)*2' Untitled.mp4
Let’s say you are given two pairs of information (\(x_1, y_1\)) and (\(x_2, y_2\)). These, for example, may represent elevations at two given locations or rainfall values at two given dates. Regardless of what they represent, let’s say you are interested in finding the value \(u\) that lies somewhere between \(y_1\) and \(y_2\), which occurs at a location \(k\) between \(x_1\) and \(x_2\). In table format, it looks something like this:
X | Y | Description |
---|---|---|
\(x_1\) | \(y_1\) | Known \(x,y\) pair just below the value you are looking for |
\(k\) | \(u\) | The pair you want the \(y\)-value for |
\(x_2\) | \(y_2\) | Known \(x,y\) pair just above the value you are looking for |
By linear interpolation, the rule of equal ratios applies, which states the following:
\[\frac{k - x_1}{x_2 - x_1} = \frac{u - y_1}{y_2 - y_1}\]
and can be solved for the unknown value, \(u\), represented by the following:
\[u = \frac{\left(y_2 - y_1\right) \left(k - x_1\right)}{x_2 - x_1} + y_1\]
Let’s say you have three single-band raster files (e.g., the red, green and blue bands for a color image) and you want to make a raster to visualize the colors. This requires you to merge the three single-band rasters into one multi-band raster. One way to do this in QGIS is to use the Build virtual raster tool found under Raster –> Miscellaneous.
For your input layers, select all your single-band raster files—remember the order in which they are added. All your raster files should have the same resolution, so all options for resolution should result in the same output. Tick the box (or set to True) to place each input file into a separate band. If you raster layers have a NODATA value, be sure to include it here. You can save your virtual raster to file (e.g., GeoTIFF) or just save to memory.