MazamaScience / MazamaSatelliteUtils

Satellite Data Download and Utility Functions
http://mazamascience.github.io/MazamaSatelliteUtils
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Color/fill variable name in plotting functions #98

Closed tabrasel closed 3 years ago

tabrasel commented 3 years ago

The goesaodc_plotScanPoints() function colors points using an SPDF's "AOD" variable:

pointsLayer <- ggplot2::geom_point(
    data = data.frame(spdf), 
    ggplot2::aes(
      x = .data$lon,
      y = .data$lat,
      color = .data$AOD
    ),
    size = pointSize,
    shape = pointShape,
    alpha = pointAlpha
  )

The goesaodc_plotScanRaster() function fills cells using a raster's "AOD" variable:

rasterLayer <- AirFirePlots::layer_raster(
    raster = raster,
    varName = "AOD",
    alpha = rasterAlpha
  )

This is all well and good if the SPDFs and Rasters are holding actual AOD values, but what about when you plot "trend" SPDFs and Rasters? The data they hold are not AOD values, but the differences in AOD values. Therefore, trend data structures should name their variable "aodTrend" instead of "AOD", which means the plotting functions can't use a hardcoded variable name. How should they be changed?

I'm leaning towards the 2nd option.