title: R - Plotting netcdf climate data
body: <p>I have been trying plot the following gridded netcdf file: "air.1999.nc" found at the following website: </p>
  
  <p><a href="http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.html" rel="noreferrer">http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.html</a></p>
  
  <p>I have tried the code below based on answers I have found here and elsewhere, but no luck.</p>
  
  <pre><code>library(ncdf);
  temp.nc &lt;- open.ncdf("air.1999.nc");
  temp &lt;- get.var.ncdf(temp.nc,"air");
  
  temp.nc$dim$lon$vals -&gt; lon
  temp.nc$dim$lat$vals -&gt; lat
  
  lat &lt;- rev(lat)
  temp &lt;- temp[nrow(temp):1,]
  
  temp[temp==-32767] &lt;- NA
  temp &lt;- t(temp)
  
  image(lon,lat,temp)
  library(maptools)
  data(wrld_simpl)
  plot(wrld_simpl, add = TRUE)
  </code></pre>
  
  <p>This code was from modified from the one found here: <a href="https://stackoverflow.com/questions/13700254/the-variable-from-a-netcdf-file-comes-out-flipped">The variable from a netcdf file comes out flipped</a></p>
  
  <p>Does anyone have any ideas or experience with using these type of netcdf files? Thanks</p>