This function takes a .csv file with gridded lat, long data and aggregates the data by spatial boundaries given different shapefiles.
metis.boundaries( boundaryRegShape = NULL, boundaryRegShpFolder = NULL, boundaryRegShpFile = NULL, boundaryRegCol = NULL, boundaryRegionsSelect = NULL, subRegShape = NULL, subRegShpFolder = NULL, subRegShpFile = NULL, subRegCol = NULL, subRegCol1 = NULL, subRegionsSelect = NULL, subRegType = "subRegType", dirOutputs = paste(getwd(), "/outputs", sep = ""), regionName = NULL, folderName = NULL, nameAppend = "", expandPercentWidth = 2, expandPercentHeight = 2, expandPercentWidthOV = 2, expandPercentHeightOV = 2, overlapShape = NULL, overlapShpFolder = NULL, overlapShpFile = NULL, labelsSize = 1.2, fillcolorNA = NULL, projX = "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0", extendedFillColor = "grey75", extendedBGColor = "lightblue1", extendedHighLightColor = "cornsilk1", extendedLabelsColor = "grey30", extdendedLabelSize = 0.7, extension = T, fillPalette = "Spectral", cropSubShape2Bound = T, grids = NULL, innerMargins = c(0.1, 0.2, 0.1, 0.2), outerMargins = c(0.01, 0.01, 0.01, 0.01), compassScale = T, scalePos = c("right", "bottom"), compassPos = c("left", "bottom"), extendedBoundary = NULL, extendedBoundaryOV = NULL )
| boundaryRegShape | Default=NULL. Boundary region shape if already read into R.  | 
    
|---|---|
| boundaryRegShpFolder | Default= NULL. Folder containing boundary region shapefile. Suggested: paste(getwd(),"/dataFiles/gis/metis/naturalEarth",sep Default=""),  | 
    
| boundaryRegShpFile | Default=NULL. Name of shapefile. Suggested: paste("ne_10m_admin_0_countries",sep Default=""),  | 
    
| boundaryRegCol | Default=NULL. Column name with region names. Suggested "NAME_0",  | 
    
| boundaryRegionsSelect | Default=NULL. The region to choose from the given shapefile.  | 
    
| subRegShape | Default=NULL. Sub-region shape if already read into R.  | 
    
| subRegShpFolder | Default=NULL. Folder containing boundary region shapefile. Suggested paste(getwd(),"/dataFiles/gis/metis/naturalEarth",sep Default=""),  | 
    
| subRegShpFile | Default=NULL. Name of sub-region shapefile. Suggested paste("ne_10m_admin_1_states_provinces",sep Default=""),  | 
    
| subRegCol | Default= NULL. Suggested for states "name",  | 
    
| subRegCol1 | Default= NULL. Suggested for states "name",  | 
    
| subRegionsSelect | Default=NULL. The region to choose from the given sub-region shapefile.  | 
    
| subRegType | Default="subRegType". Type of subregion. Eg. "states", "basins" etc.  | 
    
| dirOutputs | Default=paste(getwd(),"/outputs",sep Default=""). Location for outputs.  | 
    
| regionName | Default = NULL,  | 
    
| folderName | Default = NULL,  | 
    
| nameAppend | Default="". Name to append to saved files.  | 
    
| expandPercentWidth | Default=2. Percentage to expand boundary region beyond chosen region.  | 
    
| expandPercentHeight | Default=2. Percentage to expand boundary region beyond chosen region.  | 
    
| expandPercentWidthOV | Default=2. Percentage to expand boundary region beyond chosen region.  | 
    
| expandPercentHeightOV | Default=2. Percentage to expand boundary region beyond chosen region.  | 
    
| overlapShape | Default = NULL. If boundary lines of another shapefile are desired specify the shape here.  | 
    
| overlapShpFolder | Default = NULL. For GCAM basins use paste(getwd(),"/dataFiles/gis/metis/gcam",sep="").  | 
    
| overlapShpFile | Default = NULL. For GCAM basins use ="Global235_CLM_final_5arcmin_multipart"  | 
    
| labelsSize | Default =1.2.  | 
    
| fillcolorNA | Default =NULL. Fill color for NA values.  | 
    
| projX | Default ="+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0".  | 
    
| extendedFillColor | Default = "grey75". Color used to fill extended land areas.  | 
    
| extendedBGColor | Default = "lightblue1". Color used to fill background/water bodies.  | 
    
| extendedHighLightColor | Default = "cornsilk1". Color used to highlight region of analysis.  | 
    
| extendedLabelsColor | Default = "grey30". Color for extended country name labels.  | 
    
| extdendedLabelSize | Default =0.7. Size of extended country name labels.  | 
    
| extension | Default = T. Should the map be extended beyond chosen shapefile boudnaries.  | 
    
| fillPalette | Default ="Spectral". Palette to use to fill subregions.  | 
    
| cropSubShape2Bound | Default = T. If subregion shape file is larger than boundary file.  | 
    
| grids | Default = NULL. Metis comes with 0.5 and 0.25 grids in c(paste(getwd(),"/dataFiles/grids/emptyGrids/grid_025.csv",sep=""),  | 
    
| innerMargins | Default =c(0,0.1,0,0.1), # bottom, left, top, right  | 
    
| outerMargins | Default =c(0.01,0.01,0.01,0.01) # bottom, left, top, right  | 
    
| compassScale | Default =T  | 
    
| scalePos | Default = c("right","bottom"),  | 
    
| compassPos | Default = c("left","bottom")  | 
    
| extendedBoundary | Default=NULL, Shapefile  | 
    
| extendedBoundaryOV | Default=NULL, Shapefile paste(getwd(),"/dataFiles/grids/emptyGrids/grid_050.csv",sep="")) This may happen in the case of disputed boundaries.  | 
    
A table with data by polygon ID for each shapefile provided