How to plot latitude/longitude points over netcdf map

本小妞迷上赌 提交于 2020-01-25 05:05:57

问题


I have read in a netcdf file of observed climate data (global surface temperature) to R and would like to plot some species locality data (latitude/longitude coordinate points) over the top of this but am having difficulties doing so.

I have generated my map of temperature using:

obsula.pdclann <- open.ncdf("obsula.pdclann.nc")

temp_var <- "temp_mm_1_5m"

temp <- get.var.ncdf(obsula.pdclann, varid=temp_var)

image.plot(temp)

My species occurrence data are read in via the following:

speciesall <- read.table("C:/Users/Waterson/Documents/UOB/Data/speciesData/P.subrufa.txt", header=T, sep="\t")

coordinates <- cbind(speciesall$longitude, speciesall$latitude)

I have then created a SpatialPointsDataFrame with the coordinates:

speciesall_df <- SpatialPointsDataFrame(coordinates, speciesall, proj4string=CRS("+proj=longlat +ellps=WGS84"))

Now I am unsure of how I go about combining the point data with the netcdf map?

来源:https://stackoverflow.com/questions/22833647/how-to-plot-latitude-longitude-points-over-netcdf-map

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!