has anyone used the python code from here (written by Geir Arne Waagbo) to plot skewT plot from WRF output?
I've got a question regarding some of the functions used in the code found in pywrfplotUtils.py - which is the getXY(lon,lat) function that gets called in getDimensions(nc) function.
Below are the codes:
def getDimensions(nc): Nx = nc.getncattr('WEST-EAST_GRID_DIMENSION')-1 Ny = nc.getncattr('SOUTH-NORTH_GRID_DIMENTION')-1 Nz = nc.getncattr('BOTTOM-TOP_GRID_DIMENSION')-1 dx = nc.getncattr('DX') dy = nc.getncattr('DY') lons = nc.variables['XLAT'] lats = nc.variables['XLONG'] # find coordinates for focus point x,y = getXY(lons[Ny/2,:],lats[:,Nx/2]) return Nx,Ny,Nz,lons,lats,dx,dy,x,y def getXY(lon,lat): x_nr = 0 y_nr = 0 while (lon[x_nr] < lon_focuspoint): x_nr += 1 while (lat[y_nr] < lat_focuspoint): y_nr += 1 print "x_nr:" str(x_nr),"Lon:",str(lon[x_nr]) print "y_nr:" str(y_nr),"Lat:",str(lon[x_nr]) return x_nr,y_nr
The focus point is a variable set in the pywrfplotParams.py:
#This defines the grid box for which skewT-plots etc are based lat_focuspoint = 60.2 lon_focuspoint = 11.08
Unfortunately, I don't know what focus point is referring to, so when I use the values set by the author, obviously I get an error, and that error is - IndexError: index out of bounds.
I have found this link useful in providing the definition for the attributes asked in that question, but I'm not entirely sure if I should also get the cell indices from latitude and longitude in the WRF model grids.
Your thoughts are very much appreciated!