0
votes

I have some test using ensembleBMA in R.
When I tried to plotProbcast, contour was drawn, but the map's outline was not drawn.
How can draw this?

My code is below:

library(fields)
library(maps)
library(ensembleBMA)

color <- "black"
lat <- rep(seq(10,70,2),51)

lon <- c()
for (i in seq(60,160,2))
{
    lon <- c(lon, rep(i,31))
}

forcastData <- round(runif(1581, 4800, 5800),0)
plotProbcast(forcastData, longitude = lon, latitude = lat, interpolate = TRUE, type = "contour", levels = seq(from=4800, to=5800, by=10), col=color)

It's error code is: enter image description here

And my result is as below. I want to draw map outline as background of contour.
My R version is 4.1.1 and I am using RStudio-1.4.1717

enter image description here

1

1 Answers

1
votes

I suspect that plotProbcast is affected by a bug.
You need to set US.map <- 1 before calling plotProbcast.

library(fields)
library(maps)
library(ensembleBMA)

color <- "blue"
lat <- rep(seq(10,70,2),51)
lon <- c()
for (i in seq(60,160,2)) {
    lon <- c(lon, rep(i,31))
}
set.seed(1234)
forcastData <- round(runif(1581, 4800, 5800),0)

US.map <- 1
plotProbcast(forcastData, longitude = lon, latitude = lat, 
             interpolate = TRUE, type = "contour", 
             levels = seq(from=4800, to=5800, by=10), col=color)

enter image description here