h5_to_tiff: Convert SMAP .h5 raster into .tif raster file

View source: R/AgroSoil_generic_functions.R

h5_to_tiffR Documentation

Convert SMAP .h5 raster into .tif raster file

Description

Loads SMAP Level 4 Global 3-hourly at 9 km Soil moisture product and converts them into .tif files for easy further data processing. In addition, the output .tif file is reprojected into WGS84.

Usage

h5_to_tiff(h5.lst, mapInfo.crs_EASE2, mapInfo.crs_WGS84, out_dir)

Arguments

h5.lst

Path to folder containing downloaded SMAP .h5 files

mapInfo.crs_EASE2

SMAP CRS string. E.g. CRS("+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")

mapInfo.crs_WGS84

Destination Raster file's crs.

out_dir

Path to folder to write .tif raster files

Examples

library(rhdf5)
library(raster)

h5.lst <- list.files(".h5 folder path", pattern = glob2rx("*.h5"), full.names = T)
mapInfo.crs_EASE2 <- CRS("+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs")
mapInfo.crs_WGS84 <- CRS("+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0")
out_dir <- path to folder for writing .tif files

h5_to_tiff(h5.lst, mapInfo.crs_EASE2, mapInfo.crs_WGS84, out_dir)

kanj241/agrosoil documentation built on March 25, 2022, 12:22 a.m.