Python - How to get variable from netcdf file on a specefic location and at different level
Question: I am learning on how to plot various variable from WRF output netcdf file. My
requirement is to extract variables for a certain lat long (8.4875° N,
76.9525° E) so that to plot SkewT using matplotlib package.

Similar question I found on this SO page [netcdf4 extract for subset of lat
lon](http://stackoverflow.com/questions/29135885/netcdf4-extract-for-subset-
of-lat-lon). However, its location is a set of boundary.

Any help is appriciated.


Answer: Check out [xray](http://xray.readthedocs.org). You'll have to do some work to
make the SkewT chart but accessing and summarizing the netCDF Dataset and
variables will be pretty easy. Just a few examples below.

    
    
    import xray
    
    ds = xray.open_dataset('your_wrf_file.nc')
    
    ds_point = ds.sel(lon=76.9525, lat=8.4875)
    
    ds_point['Temperature'].plot()  # plot profile at point assuming Temperature had dimensions of (level, lat, lon)
    
    df = ds_point.to_dataframe()  # export dataset to Pandas.DataFrame
    
    temp_array = ds_point['Temperature'].values  # access the underlying numpy array of the "Temperature" variable
    

