Skip to content

AgronomicForecastingLab/THREDDS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

THREDDS

Scripts for converting LANDSAT GeoTIFF tiles into NetCDF, serving them via a local THREDDS Data Server, and extracting site-level multi-band time series through OPeNDAP subsetting.

Note: This README was reconstructed by reading the source code; the original repo had no description. Please verify the inferred purpose and usage details against your own intent before relying on it.

What it does

The workflow assembles three stages:

  1. Raster -> NetCDF conversion (LANDSAT/rastertonc.py, LANDSAT/TileMaker.R) — convert a directory of LANDSAT .tif tiles into .nc files (via ArcPy RasterToNetCDF_md in Python, or raster::writeRaster in R).
  2. Tile catalog (LANDSAT/Tile_extents.csv, built with LANDSAT/TileMaker.R) — record each tile's filename, date, and spatial extent so a downstream client can pick which tiles cover a given site.
  3. OPeNDAP site extraction (LANDSAT/Opendap.R, LANDSAT/Site_LANDSAT_reader.R) — given a list of site coordinates, look up which tiles intersect each site, subset only the needed lat/lon window over OPeNDAP from a local THREDDS server (started via the unidata/thredds-docker image if not already running), and save per-site multi-band reflectance time series as .RDS files. LANDSAT/formatter.R then restacks the extracted pixels into per-date RasterStacks for plotting (e.g. RGB composites).

Languages and key dependencies

  • Rtidyverse, raster, ncdf4, tidync, furrr, callr, lubridate, gdalUtils, rgdal, RCurl
  • Pythonarcpy (requires an ArcGIS install with the Spatial Analyst extension); standard library multiprocessing, os
  • External — Docker (for unidata/thredds-docker), a local THREDDS Data Server on port 80 / 8080

Install

R packages:

install.packages(c(
  "tidyverse", "raster", "ncdf4", "tidync", "furrr",
  "callr", "lubridate", "RCurl"
))
# gdalUtils and rgdal are retired on CRAN; install from archive or use alternatives

Python (ArcPy ships with ArcGIS Pro / ArcMap; it is not pip-installable):

# Use the Python interpreter bundled with your ArcGIS install
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" LANDSAT/rastertonc.py

Start a THREDDS server (used by the R extraction scripts):

docker run --rm --name tds -d -p 80:8080 \
  -v /path/to/content:/usr/local/tomcat/content \
  unidata/thredds-docker

Quickstart

Subset a single NetCDF from a running THREDDS server over OPeNDAP:

source("LANDSAT/Opendap.R")

url  <- "http://localhost:8080/thredds/dodsC/testAll/2013-05-131-0000009472-0000009472.nc"
xmin <- -93;    xmax <- -92.75
ymin <- 38.75;  ymax <- 39

pixels <- OpenDap_LANDSAT(url, ymax, ymin, xmin, xmax)
head(pixels)   # value, lon, lat, band

A minimal end-to-end example is in examples/extract_site.R.

What's inside

  • LANDSAT/rastertonc.py — ArcPy script: parallel conversion of .tif rasters to NetCDF.
  • LANDSAT/TileMaker.R — Builds a date/extent catalog of tiles and writes per-tile NetCDF.
  • LANDSAT/Tile_extents.csv — Catalog of tile filenames, dates, and bounding boxes.
  • LANDSAT/Opendap.ROpenDap_LANDSAT() helper: subsets a NetCDF over OPeNDAP by lat/lon bounds.
  • LANDSAT/Site_LANDSAT_reader.R — Iterates a site list, finds covering tiles, runs each subset in an isolated callr R session, saves .RDS.
  • LANDSAT/formatter.R — Reshapes extracted pixels back into per-date RasterStacks and renders RGB plots.
  • examples/extract_site.R — Minimal runnable example of the OPeNDAP subset call.

Citation

No CITATION.cff or paper reference was found in the source.

License

No LICENSE file is present — contact the authors before reuse.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors