什么是“焦点”在网格WRF-plots箱子吗?(python代码)-地球科学堆江南体育网页版栈交换江南电子竞技平台 最近30从www.hoelymoley.com 2023 - 07 - 07 - t17:08:03z //www.hoelymoley.com/feeds/question/5038 https://creativecommons.org/licenses/by-sa/4.0/rdf //www.hoelymoley.com/q/5038 5 什么是“焦点”在网格WRF-plots箱子吗?(python代码) cwmwl //www.hoelymoley.com/users/3063 2015 - 06 - 23 - t13:23:54z 2015 - 06 - 23 - t14:19:26z < p >有谁使用的python代码< a href = " https://code.google.com/p/pywrfplot/source/browse/ svn % 2 ftrunk " rel = " nofollow noreferrer " >在这里(写的盖尔·阿恩Waagbo) < / >绘制skewT情节从WRF输出?< / p > < p >我有一个问题关于代码中使用的一些功能pywrfplotUtils中找到。py——这是getXY(经度、纬度)函数中被调用getDimensions (nc)的功能。< / p > < p >下面的代码:< / p > < pre > <代码> def getDimensions (nc): Nx = nc.getncattr (WEST-EAST_GRID_DIMENSION) 1纽约= nc.getncattr (SOUTH-NORTH_GRID_DIMENTION) 1新西兰= nc.getncattr (BOTTOM-TOP_GRID_DIMENSION) 1 dx = nc.getncattr (dx) dy = nc.getncattr (dy)朗=数控。变量(' XLAT '][0]背阔肌=数控。variables['XLONG'][0] # 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!

//www.hoelymoley.com/questions/5038/-/5040 # 5040 2 由凯西回答什么是“焦点”WRF-plots网格箱子吗?(python代码) 凯西 //www.hoelymoley.com/users/64 2015 - 06 - 23 - t14:19:26z 2015 - 06 - 23 - t14:19:26z < p > Skew-T / logp情节是垂直廓线从一个点,它出现在你们的重点策划Skew-T的代码是60.2纬度,经度11.08。The snippet of code:

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 

finds the closest grid point west and south of your focus point by setting the x and y gridpoints to 0 and incrementing the index as long as the latitude/longitude values at that grid point are less than the focus point. This is what the focus point is for -- the lat/lon location you want the skew-t/log-p plot at.

The exception IndexError: index out of bounds. means that the above code tried to access a value lon[x_nr] or lat[y_nr] that was out of bounds. This means that the latitude/longitude coordinate of your focus point is not within your domain.

To run the code successfully, edit the focus point to be a point within your model domain, specifically the value of latitude and longitude that you want the skew-t profile for.

Baidu
map