728x90
이번에는 조금더 복잡한 그림을 그려보겠습니다
이번 그림은 변수가 하나가 아니라 기온, 풍향, 풍속, 기압 이렇게 4가지 변수를 한 번에 그렸습니다
이슬점온도와 풍향, 풍속을 그린 코드도 함께 있지만 그 부분은 다음 포스팅에서 다루겠습니다
begin
a = addfile("./wrfout_d01_2016-10-06_00.nc", "r")
type = "png"
wks = gsn_open_wks(type, "Surface")
res = True
res@MainTitle = "REAL-TIME WRF"
pltres = True
mpres = True
mpres@mpDataBaseVersion = "MediumRes"
mpres@mpDataResolution = "FinestResolution"
mpres@mpDataSetName = "Earth..4"
mpres@mpGridAndLimbOn = True
mpres@mpPerimOn = True
mpres@mpGeophysicalLineColor = "Black"
mpres@mpGridLineColor = "Black"
mpres@mpLimbLineColor = "Black"
mpres@mpNationalLineColor = "Black"
mpres@mpPerimLineColor = "Black"
mpres@mpUSStateLineColor = "Black"
mpres@mpGeophysicalLineThicknessF = 3.0
times = wrf_user_getvar(a, "times", -1) ;시간 변수 times 추출 : 2016-10-06_00:00:00
ntimes = dimsizes(times) ;dimension 추출 : 시간이 하나 뿐이기 때문에 1
do it = 0, ntimes-1, 2 ;반복문이지만 0번째만 실행함, ntimes - 1 = 0
print("Working on time :" + times(it)) ;작업이 돌아가고 있다는 것을 알기 위한 부분
res@TimeLabel = times(it)
;calculate Sea Level Temperature
slp = wrf_user_getvar(a, "slp", it) ;WRF 자체에는 SLP가 없지만 slp를 getvar 하면 자동으로 계산해줌
wrf_smooth_2d(slp, 3)
tc = wrf_user_getvar(a, "T2", it)
tc = tc - 273.15
td = wrf_user_getvar(a, "td2", it) ;td2도 slp와 마찬가지
u = wrf_user_getvar(a, "U", it)
v = wrf_user_getvar(a, "V", it)
u10 = wrf_user_getvar(a, "U10", it)
v10 = wrf_user_getvar(a, "V10", it)
u10 = u10 * 1.94836 ;풍속 m/s => knots
v10 = v10 * 1.94836
u10@units = "kts"
v10@units = "kts"
;Plotting T
opts = res
opts@cnFillOn = True
opts@ContourParameters = (/-10., 30., 5./)
opts@gsnSpreadColorEnd = -3
contour_tc = wrf_contour(a, wks, tc, opts)
delete(opts)
;Plotting Td
opts = res
opts@cnFillOn = True
opts@cnLinesOn = True
opts@cnLineLabelsOn = True
opts@ContourParameters = (/-10., 30., 5./)
opts@cnLineLabelBackgroundColor = -1
opts@gsnSpreadColorEnd = -3
contour_td = wrf_contour(a, wks, td, opts)
delete(opts)
;Plotting SLP
opts = res
opts@cnLineColor = "Blue"
opts@cnHighLabelsOn = True
opts@cnLowLabelsOn = True
opts@ContourParameters = (/1000., 1060., 2./)
opts@cnLineLabelBackgroundColor = -1
opts@gsnContourLineThicknessesScale = 2.0
contour_psl = wrf_contour(a, wks, slp, opts)
delete(opts)
;Plotting Wind Vector
opts = res
opts@FieldTitle = "Wind"
opts@NumVectors = 47 ;벡터의 밀도
vector = wrf_vector(a, wks, u10, v10, opts)
delete(opts)
;오버레이를 이용해서 여러개를 같이 그림
plot = wrf_map_overlays(a, wks, (/contour_tc, contour_psl, vector/), pltres, mpres)
plot = wrf_map_overlays(a, wks, (/contour_td, vector/), pltres, mpres)
end do
end
이번 코드입니다
제가 NCL로 짰던 코드들 중에 가장 긴 것 같습니다
필요한 부분은 주석으로 달아두겠습니다
결과 입니다
728x90
'NCL' 카테고리의 다른 글
작업11: WRF 모델 결과 NCL로 시각화하기4 (2) | 2023.06.22 |
---|---|
작업10: WRF 모델 결과 NCL로 시각화하기3 (0) | 2023.06.22 |
작업8: WRF 모델 결과 NCL로 시각화하기1 (0) | 2023.06.21 |
작업7: NCL로 netCDF 파일 시각화하기3 (0) | 2023.05.03 |
작업6: NCL로 netCDF 파일 시각화하기2 (0) | 2023.05.02 |