Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

wrf.g_slp.get_slp()

未关闭
#97 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
numpy, python
领域
data

调研方向

从 wrf/g_slp.py 开始,跟踪其对 util.py 的调用,尤其是 extract_vars 和 _extract_var;traceback 显示这里会读取 netCDF 数据。比较 timeidx=0 和 wrf.ALL_TIMES 的复现结果,并检查导致停滞的变量访问。完成的标准是 get_slp 能够处理所有时间索引,而不会出现报告中的长时间变慢。

由索引模型根据 Issue 内容生成。

描述

bug support

For some reason with this wrf.g_slp.get_slp is having problems reading in the data for all timeidx's. The top one for 1 time index takes 00:00:01 seconds to run. For any of my other variables (T,Td,WS,WDIR, U10, V10, RH) it takes about 5-10 seconds to get the variable for all times. I stopped the code after it seemed to be slowing my computer and was taking more than 10 minutes (on that one command).

I am wondering if there is something wrong in the wrf-python code for this function. I cannot find many other people using this specific function.

ncfile = Dataset(listing[0])
where listing[0] is the wrfout_d03 file.

WORKS
wrf.g_slp.get_slp(ncfile,timeidx=0,method='cat',squeeze=True,cache=None,meta=False,_key=None,units='Pa')

DOES NOT WORK
wrf.g_slp.get_slp(ncfile,timeidx=wrf.ALL_TIMES,method='cat',squeeze=True,cache=None,meta=False,_key=None,units='Pa')

Traceback (most recent call last):

File "", line 1, in
runfile('/Users//Documents//Observational_Data/Python_Programs/model_analysis_V2.py', wdir='/Users//Documents//Observational_Data/Python_Programs')

File "/Users/*/anaconda3/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 827, in runfile
execfile(filename, namespace)

File "/Users/*/anaconda3/lib/python3.6/site-packages/spyder_kernels/customize/spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "/Users//Documents//Observational_Data/Python_Programs/model_analysis_V2.py", line 749, in
elif variable == "Pressure (Pa)": WRF_VAR = wrf.g_slp.get_slp(ncfile,timeidx=wrf.ALL_TIMES, method='cat',squeeze=True,cache=None,meta=False,_key=None,units='Pa')

File "/Users/*/anaconda3/lib/python3.6/site-packages/wrf/metadecorators.py", line 88, in func_wrapper
return wrapped(*args, **kwargs)

File "/Users/*/anaconda3/lib/python3.6/site-packages/wrf/decorators.py", line 44, in func_wrapper
return do_conversion(wrapped(*args, **kwargs), unit_type,

File "/Users/*/anaconda3/lib/python3.6/site-packages/wrf/g_slp.py", line 80, in get_slp
meta=False, _key=_key)

File "/Users/*/anaconda3/lib/python3.6/site-packages/wrf/util.py", line 2280, in extract_vars
for var in varlist}

File "/Users/*/anaconda3/lib/python3.6/site-packages/wrf/util.py", line 2280, in
for var in varlist}

File "/Users/*/anaconda3/lib/python3.6/site-packages/wrf/util.py", line 2212, in _extract_var
result = wrfin.variables[varname][:]

File "netCDF4/_netCDF4.pyx", line 4157, in netCDF4._netCDF4.Variable.getitem

File "netCDF4/_netCDF4.pyx", line 4291, in netCDF4._netCDF4.Variable._toma

File "/Users/*/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py", line 42, in _any
def _any(a, axis=None, dtype=None, out=None, keepdims=False):

KeyboardInterrupt

主要语言
Python
星标
498
派生
178
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

NCAR/wrf-python 的其他 Issue

查看 NCAR/wrf-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。