| sits_get_data {sits} | R Documentation |
Retrieve a set of time series from a data cube or from a time series service. Data cubes and puts it in a "sits tibble". Sits tibbles are the main structures of sits package. They contain both the satellite image time series and their metadata. There are four ways of specifying data to be retrieved:
CSV file:Provide a CSV file with columns "longitude", "latitude", "start_date", "end_date" and "label" for each sample
SHP file:Provide a shapefile in POINT or POLYGON geometry containing the location of the samples and an attribute to be used as label. Also, provide start and end date for the time series.
samples:A data.frame with with columns "longitude", "latitude", "start_date", "end_date" and "label" for each sample
single point:Provide the values "longitude", "latitude", "start_date", "end_date" and "label" to obtain a time series for a spacetime location
sits_get_data( cube, file = NULL, samples = NULL, longitude = NULL, latitude = NULL, start_date = NULL, end_date = NULL, label = "NoClass", bands = NULL, impute_fn = sits_impute_linear(), shp_attr = NULL, .n_pts_csv = NULL, .n_shp_pol = 30, multicores = 1 )
cube |
Data cube from where data is to be retrieved. |
file |
File with information on the data to be retrieved. |
samples |
Data.frame with samples location in spacetime. |
longitude |
Longitude of the chosen location. |
latitude |
Latitude of the chosen location. |
start_date |
Start of the interval for the time series in "YYYY-MM-DD" format (optional). |
end_date |
End of the interval for the time series in "YYYY-MM-DD" format (optional). |
label |
Label to be assigned to the time series (optional). |
bands |
Bands to be retrieved (optional). |
impute_fn |
Imputation function for NA values. |
shp_attr |
Attribute in the shapefile to be used as a polygon label. |
.n_pts_csv |
Number of points from CSV file to be retrieved. |
.n_shp_pol |
Number of samples per polygon to be read (for POLYGON or MULTIPOLYGON shapefile). |
multicores |
Number of threads to process the time series. |
A tibble with the metadata and data for each time series <longitude, latitude, start_date, end_date, label, cube, time_series>.
Gilberto Camara
# -- Read a point in a raster data cube
# Create a data cube based on files
data_dir <- system.file("extdata/raster/mod13q1", package = "sits")
raster_cube <- sits_cube(
source = "BDC",
collection = "MOD13Q1-6",
data_dir = data_dir,
delim = "_",
parse_info = c("X1", "X2", "tile", "band", "date")
)
# read the time series of the point from the raster
point_ts <- sits_get_data(raster_cube,
longitude = -55.554,
latitude = -11.525
)
# --- Read a set of points described by a CSV file
# read data from a CSV file
csv_file <- system.file("extdata/samples/samples_sinop_crop.csv",
package = "sits"
)
points_csv <- sits_get_data(raster_cube, file = csv_file)