import_monthly_data: Import a monthly SpatRaster from monthly NCDF or GeoTIFF...

View source: R/Monthly_data_utils.R

import_monthly_dataR Documentation

Import a monthly SpatRaster from monthly NCDF or GeoTIFF files.

Description

Import a monthly SpatRaster from monthly NCDF or GeoTIFF files.

Usage

import_monthly_data(rst_path, start_date, end_date, years = NULL)

Arguments

rst_path

File path to either:

  • 'GTiff files': Monthly raster files that include the date in the file names (e.g., 'ProductX_1989-02.tif'). The dates must have the format '%Y-%m'.

  • 'NCDF files': Annual raster files that contain the monthly layers respective for that year. The file name must include the date (e.g., 'ProductX_1989.nc'). The dates must have the format '%Y'.

start_date

Position where the dates of the raster files start. For example, start_date = 10 for 'ProductX_1989-02.tif' as the date start in the 10th character.

end_date

Position where the dates of the raster files end. For example, end_date = 16 for 'ProductX_1989-02.tif', and end_date = 13 for 'ProductX_1989.nc'.

years

Integer vector indicating the years that should be imported. For example, years <- 2000:2010 for importing monthly data from 2000 to 2010.

Value

SpatRaster of the monthly data that will be used in further analysis.


obaezvil/SpatIndex documentation built on Aug. 9, 2024, 3:42 p.m.