processCSV: Read in image csv

Description Usage Arguments Details Value

View source: R/processCSV.R

Description

processCSV will read in a csv file of SST and return the matrices needed for kmeans().

Notes: See also the tidy version.

Usage

1
processCSV(file, aspect_ratio, lat_range, long_range, has.alt = FALSE)

Arguments

file

name of the csv file

aspect_ratio

c(width, height). This is c(length(unique(lons)), length(unique(lats)))

lat_range

What range to subset

long_range

What range to subset

has.alt

If TRUE, then remove 2nd column

Details

stats::kmeans() wants a matrix where each row is a sample of your data. So we want each row of our data matrix to be a date and the columns will be the pixels in the image.

Value

The function returns dat.wide which is the original data (in the specified lat/lon box) where each row is a date and each column is a pixel in the image grid. dat.wide may have NAs (say from land if working with ocean data). dat.clean is the data with NA pixels (i.e. land) removed. pos.loc is the location of the non-NA pixels (columns in dat.wide) so that the image can be reconstructed after k clustering is performed.


UW-Upwelling-Project/imageryML documentation built on Dec. 18, 2021, 6:11 p.m.