#!/bin/bash
###################################
# README.sh
# Author: Jitendra Kumar (jkumar@climatemodeling.org)
# Oak Ridge National Laboratory
#
# This README provides guidance to process and import the data sets in this collection into your GIS system.
#
# All data sets in this collection are georeferenced and are in Alaska Albers Equal Area projection system.
# Packaged data set provides all the information one may need to process and import them into a GIS.
#
# --------------------
#
# --------------------
# File Formats: All raster data sets are provided as geoferenced NetCDF files and vector data sets as georeferenced Shape files.
# --------------------
#
# --------------------
# Linux/MacOS + GRASS Users: You are in luck since this README script has been written as a shell script. Run this in your GRASS terminal, or shell terminal (if you have GRASS already available in your environment) and it will do following for you.
# 1. Create a new GRASS projection and mapset
# 2. Import all raster and vector data products from this collection
# And you are all set
# --------------------
# Windows + GRASS Users: Please follow the steps below in your GRASS GUI to process and import these data sets
# --------------------
# ArcGIS, ENVI, ERDAS etc. (non GRASS GIS) Users: Your software system should be able to read and import these georeferenced NetCDF and Shape files.
# --------------------
#
# This script assumes that you are maintaining the directory hierarchy similar to the distribution directory
# .
# ├── ecoregions
# ├── realized_centroids
# └── representativeness
#
# --------------------
# Dataset reference:
# Hoffman, Forrest M., Jitendra Kumar, Richard T. Mills, and William W. Hargrove. (2013). Representativeness-based Sampling Network Design for the State of Alaska. DOI:10.5440/1108686 http://dx.doi.org/10.5440/1108686
#
# Paper reference:
# Hoffman, Forrest M., Jitendra Kumar, Richard T. Mills, and William W. Hargrove. (2013) Representativeness-based Sampling Network Design for the State of Alaska. Landscape Ecology, 28(8):1567–1586. doi:10.1007/s10980-013-9902-0
###################################
# --------------------------------
# Importing data set in GRASS GIS
# --------------------------------
# 1. Create Albers Equal Area projection
g.proj -c wkt=alaska_albers_equalarea.prj location=ak_aea
# 2. Change to newly create location
g.gisenv set="LOCATION_NAME=ak_aea"
g.gisenv set="MAPSET=PERMANENT"
# Create a new mapset if desired
g.mapset -c Hoffman_LandEcol_2013
# 3. Import data from NetCDF files as raster in GRASS
clust=(10 20 50 100)
periods=("2000_2009" "2090_2099")
sites=("Atqasuk" "Barrow" "Council" "Fairbanks" "Ivotuk" "Kougarok" "Prudhoe_bay" "Toolik_lake" "8site" "BarrowCouncil")
# Import ecoregions
echo "IMPORTING ECOREGION MAPS"
cd ecoregions
for((k=0; k4; k++)) do
for((t=0; t2; t++)) do
r.in.gdal in=NETCDF:"alaska_${periods[t]}_dem_Feb2012.${clust[k]}.nc":ecoregions${clust[k]} out=ecoregion_${periods[t]}.${clust[k]} title="AK Ecoregions (${periods[t]}), Levels of division = ${clust[k]}"
done
done
cd ..
# Import representativeness maps
echo "IMPORTING REPRESENTATIVENESS MAPS"
cd representativeness
for((s=0; s10; s++)) do
for((tb=0; tb2; tb++)) do
for((ts=0; ts2; ts++)) do
r.in.gdal in=NETCDF:"${sites[s]}ness_${periods[tb]}_on_${periods[ts]}_point_dem_Feb2012.nc":${sites[s]}_representativeness out=${sites[s]}_representativeness_${periods[tb]}_on_${periods[ts]} title="Representativeness of ${sites[s]} site: ${periods[tb]} on ${periods[ts]}"
done
done
done
cd ..
# 4. Import realized centroid vector layers
echo "IMPORTING REALIZED ECOREGION CENTROIDS"
cd realized_centroids
for((k=0; k4; k++)) do
for((t=0; t2; t++)) do
unzip realized_centroids_${periods[t]}_${clust[k]}.zip
v.in.ogr dsn=realized_centroids_${periods[t]}_${clust[k]}/realized_centroids_${periods[t]}_${clust[k]}.shp out=realized_centroids_${periods[t]}_${clust[k]}
done
done
cd ..