title: How to extract historical weather data based on specific longitudes and latitudes?
body: <p>I need to extract historical weather data at a monthly basis, from 2001 to 2018, based on specific locations in Europe (all locations are in the sea). I have the longitude and latitude stored in separate columns:</p>
  
  <pre><code>longitude    latitude
  
  55.2000       6.8500
  52.6450       1.7870
  53.1350       1.1470
  55.3430       10.95580
  </code></pre>
  
  <p>I looked into RNCEP package in R, which stores weather data. But to extract it I have to insert the interval for latitude and longitude (for example from 0 to 60), which gets the weather data at increments of 2.5 for latitude and longitude. How can I extract it for the precise latitude and longitude I need?</p>
  
  <p>This is the code that extracts the weather data at the 2.5 increment.</p>
  
  <pre><code>#Define limits for latitude and longitude
  min_lat &lt;- min(data$latitude, na.rm = TRUE)
  max_lat &lt;- max(data$latitude, na.rm = TRUE)
  
  min_lon &lt;- min(data$longitude, na.rm = TRUE)
  max_lon &lt;- max(data$longitude, na.rm = TRUE)
  
  # define arguments for latitude and longitude
  lat_range &lt;- c(min_lat, max_lat)
  lon_range &lt;-c(min_lon, max_lon)
  
  # get monthly air temperature between 2001 and 2018
  weather &lt;- NCEP.gather(variable = "air.sig995", level = "surface", months.minmax = c(1,12),
                         years.minmax = c(2001,2018), lat.southnorth =lat_range,
                         lon.westeast = lon_range)
  
  # dimensions (obs. at time 00:00, 6:00, 12:00, 18:00 each day)
  dim(weather) #creates 3 dimensions [lat, lon, time]
  
  # extract date and time based on created weather dataset
  date_time &lt;- dimnames(weather)[[3]]
  # format UTC date
  date_time &lt;- ymd_h(date_time)
  
  # extract longitude &amp; latitude based on created weather dataset
  lat &lt;- dimnames(weather)[[1]] # in increments of 2.5
  lon &lt;- dimnames(weather)[[2]] # in increments of 2.5
  
  #Calculate the mean daily air temp. of the different times of day
  w &lt;- NCEP.aggregate(weather, YEARS = TRUE, MONTHS = TRUE, HOURS = FALSE, fxn='mean')
  
  #Visualize temperature as heatmap for 1 day
  NCEP.vis.area(w, layer = 1, show.pts = TRUE, draw.contours = TRUE, cols = heat.colors(64), transparency = 0.4)
  </code></pre>
  
  <p>My result just extracts the historical weather data for the entire region, setting the range for longitude and latitude. But I need the weather conditions (such as mean temperature for the month) for the precise locations, based on my longitude and latitude columns for each month for all the years (2001 to 2018). Is it possible to do this with RNCEP package? Or what other options could I try?</p>
  
  <p><em>Final results should be similar to this:</em></p>
  
  <pre><code>longitude    latitude   month  year  temperature
  
  55.2000       6.8500     1     2001    20
  55.2000       6.8500     2     2001    20
  55.2000       6.8500     3     2001    20
  
  ...
  
  55.2000       6.8500     1     2018    20
  
  ...
  
  52.6450       1.7870     2
  
  ...
  
  </code></pre>
  
  <p>I am open to any suggestion that could bring be closer to the solution, not only the final solution to the problem. Thanks.</p>