area_extrac: Extracts a pre-defined region from ".gz"-file and saves...

View source: R/area_extrac.r

area_extracR Documentation

Extracts a pre-defined region from '.gz'-file and saves subset as a new '.gz'-file

Description

Extracts a pre-defined region from '.gz'-file and saves subset as a new '.gz'-file (gzip compressed format). Basically it represents a combined call of regions, crop, raster2matrix and writebin.

Usage

area_extrac(obj,area)

Arguments

obj

Character string indicating search criteria for '.gz'-files.

area

Character string identifying the region that should be extracted. area must be a subregion of the original region defined by the '.gz'-file. See region_definitions for area definitions and use add.region to add new regions.

Author(s)

Robert K. Bauer

See Also

readbin, writebin, crop, raster2matrix, param_unconvert

Examples

## Example 1: extract, write '.gz'-files, following default plot-procedure
library(raster)

# load sample-'.gz'-file
path <- system.file("test_files", package="oceanmap")
gz.files <- Sys.glob(paste0(path,'/*.gz'))[1] # load sample-'.gz'-files
print(gz.files)
# area_extrac(gz.files[1],area='lion')

# gz <- Sys.glob(path,'/medw4*.gz') # load new-'.gz'-file
# v(gz) # visualize new-'.gz'-file
# system(paste('rm', gz))       
# v(gz.files[1],v_area='lion')

oceanmap documentation built on Nov. 10, 2023, 5:08 p.m.