et mapgenerator with monarch
Hi,
I am try to plot a contour maps using mapgenerator through the et library. I can plot a map but the colours do not match with the values in the netcdf.
Here the data I am using:
### Clean workspace
rm(list=ls())
### Load packages
lib <- c("grid","plyr","reshape2","openair","verification","fields","plyr","ncdf4",
"maptools","maps","rasterVis","raster", "ggplot2","gplots","mapdata",
"lattice","gridExtra","ggmap","scales","gtable","rmarkdown", "reticulate","yaml","et")
sapply(lib, function(x) require(x, character.only = TRUE))
plotmap <- import("mapgenerator.plotting.plotmap")
### End load packages
expid<-"a1wd"
exp_name<-expid
output_path<-"/esarchive/scratch/mtpay/output_multimodel_new/"
fig_path_out<-paste0(output_path,"/maps/")
path_storage<-paste0("/esarchive/exp/monarch/",expid,"/eu/monthly/")
var_name<-"O3"
var_id<-"sconco3"
date_tmp<-"201601"
change_units_factor<-"1962"
pol.selec<-c(paste0(var_name,"_HL"))
##### Plotting
path_netCDF <- paste0(path_storage, var_id, "/", var_id, "_", date_tmp, ".nc")
if (file.exists(as.character(path_netCDF))) {
var_netCDF <- paste0(var_id,"*",change_units_factor)
config_mg1<-c(paste0("/home/Earth/mtpay/Documents/script/Rtoolkit/pack_cams50/","config_map.cfg"),"General",pol.selec)
h=0
title1<-paste0(exp_name," ","concentration(µg/m³) ",var_name, " ",date_tmp,"_",h)
fileout1<- paste0(fig_path_out,"/","map_",exp_name,"_",var_name,"_",date_tmp,"_",h)
plot_map_mg(background = c(path_netCDF,var_netCDF,h),
title = title1,
fileout = fileout1,
config_mg = config_mg1
)
}