- 积分
- 2341
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2019-1-14
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2020-6-1 18:44:47
|
显示全部楼层
- ;*************************************************
- ; corel_3.ncl
- ;
- ; Concepts illustrated:
- ; - Calculating a two-dimensional correlation in time
- ; - Reordering an array
- ; - Copying attributes from one variable to another
- ; - Copying coordinate arrays from one variable to another
- ; - Removing the end boxes in a labelbar
- ;
- ;************************************************
- ;
- ; These files are loaded by default in NCL V6.2.0 and newer
- ; 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"
- begin
- ;************************************************
- ; open file and read in variable
- ;***********************************************
- in1 = addfile("J:\实验数据\结果\wrfout201801.nc","r")
- ;diri="J:/"
- ;files=systemfunc("ls "+diri+"met_em.d01.*.nc")
- ; in2=addfiles(files,"r")
- in2 = addfile("J:\实验数据\erain\2018\sur\201801.nc","r")
-
- tmp1 = in1->SWDOWN
- tmp2 = in2->sp
- ;************************************************
- ; reorder to get time as right most dimension
- ;***********************************************
- ts1 = tmp1(south_north|:,west_east|:,Time|:)
- ts2 = tmp2(latitude|:,longitude|:,time|:)
- ;************************************************
- ; calculate cross correlations
- ;************************************************
- maxlag = 2 ; set lag
- ; note, the max lag should not be more than N/4
-
- ccr = esccr(ts1,ts2,maxlag) ; calc cross correlations
- ; copy meta data and coordinate variables using contributed functions
- copy_VarAtts(ts1, ccr)
- copy_VarCoords_1(ts2,ccr)
- ;************************************************
- ; plot the correlations
- ;************************************************
- wks = gsn_open_wks("png","corelsp") ; send graphics to PNG file
-
- res = True ; make plot mods
- res@cnFillOn = True ; turn on color
- res@cnFillPalette = "BlWhRe" ; set color map
- res@cnLinesOn = False ; turn off contour lines
- res@cnLevelSelectionMode = "ManualLevels" ; manually set cn levels
- res@cnMinLevelValF = -1. ; min level
- res@cnMaxLevelValF = 1. ; max level
- res@cnLevelSpacingF = .1 ; contour level spacing
- res@cnLabelBarEndStyle = "ExcludeOuterBoxes" ; remove the two end boxes from the labelbar
- res@pmLabelBarWidthF = 0.8
- lag = 0
- res@tiMainString = "Correlations at lag "+lag
- plot = gsn_csm_contour_map(wks,ccr(:,:,lag),res)
- ;************************************************
- end
-
复制代码
这个是在ncl官网找的实例,自己对需要修改的参数进行了修改 另外两个文件一个是wrf跑出来的结果,一个就是从ecmef那里下载的再分析数据 不知道是不是我在修改参数的时候有些地方没修改到位,麻烦看一下 |
|