Is it possible to clip a shapefile to an image() in R?

المشرف العام

Administrator
طاقم الإدارة
I am working on mapping some netcdf data in R and have been having a tough time trying to perform a clip with an imported country shapefile that I'm using. Here is my question from yesterday. If you know anything about that, feel free to pop over there and answer that question. :)

BUT I'll start fresh here. So for my work, we are planning on mapping tons and tons of weather data all across the globe. For practice, the guy providing our data provided us with some "example" data to play with. My boss would like for me to create my maps in R. These maps are intended to be return period maps. The data is in netcdf format. I was able to map the netcdf data with the levelplot function from the rasterVis package. I was also able to map the netcdf data with a simple image function. Here's my code (sorry for the funky naming conventions; I've just been playing around with this):

library(maptools) library(ncdf4) library(RColorBrewer) library(raster) setwd("D:\\stuff") #Madagascar shapefile madagascar
 
أعلى