爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 7562|回复: 6

NNRP 6-8月 10年平均 矢量风求助

[复制链接]

新浪微博达人勋

发表于 2014-6-23 22:36:41 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册 新浪微博登陆

x
用NNRP2 2001-2010的资料。绘制矢量风,脚本如下;
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
fu1=addfile("2001/uwnd.2001.nc","r")
fv1=addfile("2001/vwnd.2001.nc","r")
U1=short2flt(fu1->uwnd)
V1=short2flt(fv1->vwnd)
fu2=addfile("2002/uwnd.2002.nc","r")
fv2=addfile("2002/vwnd.2002.nc","r")
U2=short2flt(fu2->uwnd)
V2=short2flt(fv2->vwnd)
fu3=addfile("2003/uwnd.2003.nc","r")
fv3=addfile("2003/vwnd.2003.nc","r")
U3=short2flt(fu3->uwnd)
V3=short2flt(fv3->vwnd)
fu4=addfile("2004/uwnd.2004.nc","r")
fv4=addfile("2004/vwnd.2004.nc","r")
U4=short2flt(fu4->uwnd)
V4=short2flt(fv4->vwnd)
fu5=addfile("2005/uwnd.2005.nc","r")
fv5=addfile("2005/vwnd.2005.nc","r")
U5=short2flt(fu5->uwnd)
V5=short2flt(fv5->vwnd)
fu6=addfile("2006/uwnd.2006.nc","r")
fv6=addfile("2006/vwnd.2006.nc","r")
U6=short2flt(fu6->uwnd)
V6=short2flt(fv6->vwnd)
fu7=addfile("2007/uwnd.2007.nc","r")
fv7=addfile("2007/vwnd.2007.nc","r")
U7=short2flt(fu7->uwnd)
V7=short2flt(fv7->vwnd)
fu8=addfile("2008/uwnd.2008.nc","r")
fv8=addfile("2008/vwnd.2008.nc","r")
U8=short2flt(fu8->uwnd)
V8=short2flt(fv8->vwnd)
fu9=addfile("2009/uwnd.2009.nc","r")
fv9=addfile("2009/vwnd.2009.nc","r")
U9=short2flt(fu9->uwnd)
V9=short2flt(fv9->vwnd)
fu10=addfile("2010/uwnd.2010.nc","r")
fv10=addfile("2010/vwnd.2010.nc","r")
U10=short2flt(fu10->uwnd)
V10=short2flt(fv10->vwnd)
U=(U1(603:847,:,:,:)+U2(603:847,:,:,:)+U3(603:847,:,:,:)+U4(607:851,:,:,:)+U5(603:847,:,:,:)+U6(603:847,:,:,:)+U7(603:847,:,:,:)+U8(607:851,:,:,:)+U9(603:847,:,:,:)+U10(603:847,:,:,:))/10.0
V=(V1(603:847,:,:,:)+V2(603:847,:,:,:)+V3(603:847,:,:,:)+V4(607:851,:,:,:)+V5(603:847,:,:,:)+V6(603:847,:,:,:)+V7(603:847,:,:,:)+V8(607:851,:,:,:)+V9(603:847,:,:,:)+V10(603:847,:,:,:))/10.0
tU=dim_avg_n(U,0)
tV=dim_avg_n(V,0)
;----------850hpa-----------
u=tU(2,:,:)
v=tV(2,:,:)

wks=gsn_open_wks("ps","NNRP2_UV_850_JJA_2001_2010")

resuv = True
resuv@tfDoNDCOverlay =True ;trun off map projection

resuv@vcRefMagnitudeF=15.0
resuv@vcRefLengthF=0.045
;thin the vectors
resuv@vcMinDistanceF=0.017
resuv@tiMainString="JJA Mean U-VWind NNRP2 850hpa 2001-2010"
plot=gsn_csm_vector_map(wks,u,v,resuv)
delete(resuv)
delete(plot)
delete(u)
delete(v)
end

得图,如下。老板说不对,在120E应该看到显著的西南风,请教各位,帮着看看,是否脚本有错。

捕获.JPG


图2

图2
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-6-24 00:54:50 | 显示全部楼层
u,v的坐标变量丢了。应该是从U,V的计算开始就没有坐标了。
另外,你老板会不会让你和图2一样,求1948到2006年的均值?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-6-24 11:22:05 | 显示全部楼层
如果我有,U和V两个方向的风速,如何合并并做风场呢。。。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-6-24 16:49:32 | 显示全部楼层
longlivehj 发表于 2014-6-24 00:54
u,v的坐标变量丢了。应该是从U,V的计算开始就没有坐标了。
另外,你老板会不会让你和图2一样,求1948到20 ...

就画10年的,看看效果。“u,v的坐标变量丢了”,可否明确一下,如何处理,避免错误。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-6-24 17:17:34 | 显示全部楼层
本帖最后由 longlivehj 于 2014-6-24 17:48 编辑
nuistxue 发表于 2014-6-24 16:49
就画10年的,看看效果。“u,v的坐标变量丢了”,可否明确一下,如何处理,避免错误。

就在你的代码上改了一下,红色标出来了。
问你1948到2007年平均的意思是,你可以用addfiles或循环来做。否则,60年平均,按你目前的写法,只是读文件就要写60 * 4 = 240行程序。

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;load  "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
begin
fu1=addfile("2001/uwnd.2001.nc","r")
fv1=addfile("2001/vwnd.2001.nc","r")
U1=short2flt(fu1->uwnd)
V1=short2flt(fv1->vwnd)
fu2=addfile("2002/uwnd.2002.nc","r")
fv2=addfile("2002/vwnd.2002.nc","r")
U2=short2flt(fu2->uwnd)
V2=short2flt(fv2->vwnd)
fu3=addfile("2003/uwnd.2003.nc","r")
fv3=addfile("2003/vwnd.2003.nc","r")
U3=short2flt(fu3->uwnd)
V3=short2flt(fv3->vwnd)
fu4=addfile("2004/uwnd.2004.nc","r")
fv4=addfile("2004/vwnd.2004.nc","r")
U4=short2flt(fu4->uwnd)
V4=short2flt(fv4->vwnd)
fu5=addfile("2005/uwnd.2005.nc","r")
fv5=addfile("2005/vwnd.2005.nc","r")
U5=short2flt(fu5->uwnd)
V5=short2flt(fv5->vwnd)
fu6=addfile("2006/uwnd.2006.nc","r")
fv6=addfile("2006/vwnd.2006.nc","r")
U6=short2flt(fu6->uwnd)
V6=short2flt(fv6->vwnd)
fu7=addfile("2007/uwnd.2007.nc","r")
fv7=addfile("2007/vwnd.2007.nc","r")
U7=short2flt(fu7->uwnd)
V7=short2flt(fv7->vwnd)
fu8=addfile("2008/uwnd.2008.nc","r")
fv8=addfile("2008/vwnd.2008.nc","r")
U8=short2flt(fu8->uwnd)
V8=short2flt(fv8->vwnd)
fu9=addfile("2009/uwnd.2009.nc","r")
fv9=addfile("2009/vwnd.2009.nc","r")
U9=short2flt(fu9->uwnd)
V9=short2flt(fv9->vwnd)
fu10=addfile("2010/uwnd.2010.nc","r")
fv10=addfile("2010/vwnd.2010.nc","r")
U10=short2flt(fu10->uwnd)
V10=short2flt(fv10->vwnd)

U = U1(603:847,:,:,:)
V = U

U=(U1(603:847,:,:,:)+U2(603:847,:,:,:)+U3(603:847,:,:,:)+U4(607:851,:,:,:)+U5(603:847,:,:,:)+U6(603:847,:,:,:)+U7(603:847,:,:,:)+U8(607:851,:,:,:)+U9(603:847,:,:,:)+U10(603:847,:,:,:))/10.0
V=(V1(603:847,:,:,:)+V2(603:847,:,:,:)+V3(603:847,:,:,:)+V4(607:851,:,:,:)+V5(603:847,:,:,:)+V6(603:847,:,:,:)+V7(603:847,:,:,:)+V8(607:851,:,:,:)+V9(603:847,:,:,:)+V10(603:847,:,:,:))/10.0

tU=dim_avg_n_Wrap(U,0)
tV=dim_avg_n_Wrap(V,0)


;----------850hpa-----------
u=tU(2,:,:)
v=tV(2,:,:)

wks=gsn_open_wks("ps","NNRP2_UV_850_JJA_2001_2010")

resuv = True
resuv@tfDoNDCOverlay =True ;trun off map projection

resuv@vcRefMagnitudeF=15.0
resuv@vcRefLengthF=0.045
;thin the vectors
resuv@vcMinDistanceF=0.017
resuv@tiMainString="JJA Mean U-VWind NNRP2 850hpa 2001-2010"
plot=gsn_csm_vector_map(wks,u,v,resuv)
delete(resuv)
delete(plot)
delete(u)
delete(v)
end




密码修改失败请联系微信:mofangbao

新浪微博达人勋

 楼主| 发表于 2014-6-26 15:02:21 | 显示全部楼层
longlivehj 发表于 2014-6-24 17:17
就在你的代码上改了一下,红色标出来了。
问你1948到2007年平均的意思是,你可以用addfiles或循环来做。 ...

多谢,多谢,已顺利解决。addfiles循环是好用很多,代码简洁。
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2014-8-1 20:49:10 | 显示全部楼层
楼主可不可以分享一下addfile怎么写的脚本?
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表