NCL

작업12: NCL로 기상자료 입력하기

이석사 중 2023. 7. 16. 23:43
728x90

이번에는 NCL을 이용해서 지도를 그리고 그 위에 기상전문을 입력시켜셔 

 

일기 부호를 입력해보겠습니다


이번 포스팅은 기상전문에 대해 설명이 조금 필요합니다

 

NCL 공식 사이트에서 제공하는 전문 작성 방식입니다

 

영어로 되어 있어서 한글로 무슨 의미인지 뒤에 달아두겠습니다

character 0	=	iR	-	the precipitation data indicator  #강수 자료 표시
character 1	=	iX	-	weather data and station type indicator #일기 자료 표시
character 2	=	h	-	height above ground of base of lowest cloud #운저고도
characters 3-4	=	VV	-	visibility in miles and fractions #시정

character 5	=	N	-	total amount of cloud cover #전운량
characters 6-7	=	dd	-	direction from which wind is blowing #풍향(16방위)
characters 8-9	=	ff	-	wind speed in knots #풍속(단위 : Knots)

If character 10 = "1", then #1로 시작하는 부분은 온도 자료를 나타냄
character 11	=	sn	- sign of temperature #온도 자료의 부호(0 : 영상, 1 : 영하)
characters 12-14	=	TTT	- current air temperature #기온(소수점 없이 표기, 26.9 => 10269)

If character 15 = "2", then #2로 시작하는 부분은 이슬점 온도 자료를 나타냄
character 16	=	sn	- sign of temperature #이슬점 온도 자료의 부호(0 : 영상, 1 : 영하)
characters 17-19	=	Td	- dew point #이슬점온도(소수점 없이 표기, 21.9 => 20219)

If character 20 = "3", then #관측소 기압 (잘 사용하지 않음, 30000으로 표시하는 경우가 많음)
characters 21-24	=	PO	- station pressure (not plotted)

If character 25 = "4", then #해면 기압(대부분 해면 기압으로 표시함)
characters 26-29	=	PPPP	- pressure reduced to sea level 
#소수점 한 자리로 표시(40071 : 1007.1hPa, 49987 : 998.8hPa)

If character 30 = "5", then #기압 변화량을 나타냄
character 31	=	a	- characteristic of barograph #기압 변화 경향 (계속 하강, 계속 상승, 일정 등)
characters 32-34	=	ppp	- pressure change, last 3 hrs. #3시간 동안의 기압 변화량

If character 35 = "6", then #강수량 자료
characters 36-38	=	RRR	- precipitation #강수량 자료
character 39	=	tR	- time duration of precipitation #집수 시간

If character 40 = "7", then #일기 자료
characters 41-42	=	ww	- present weather #현재 일기
character 43	=	W1	- most significant past weather #과거 일기
character 44	=	W2	- 2nd most sig. past weather #과거 일기

If character 45 = "8", then #구름 자료
character 46	=	Nh	- Fraction of sky cover #중하층 운량
character 47	=	CL	- cloud type, low clouds #하층 운형
character 48	=	CM	- cloud type, medium clouds #중층 운형
character 49	=	CH	- cloud type, high clouds #상층 운형

읽어보시고 참조하시면 될 것 같습니다

 

기상자료들은 기상자료개방포털과 방재기상정보시스템에서 참고할 수 있는 부분은 최대한 참고해서

 

전문을 입력했습니다

 

없는 부분들은 관측된 마지막 시점의 자료를 가져다 쓰거나 임의의 값을 넣는 식으로 완성했습니다


코드입니다

begin
  cities = (/"Gangneung", "Seoul", "Jeju", "Gwangju", " Busan"/)

  city_lats = (/37.75147, 37.57142, 33.51411, 35.1729, 35.1047/)

  city_lons = (/128.89099, 126.9658 ,126.52969, 126.8916, 129.032/)

  imdat = (/"11246923021024820219300004006454000600517706089030", \
          "11216909021026220234300004005953003600117626087521", \
          "11227718041027020242300004006950005600017626282105",\
          "11211918031026220250300004007150005602817102189500",\
          "11208818051023920219300004007358001607617102285258"/)


  cmap = (/(/1., 1., 1./),(/0., 0., 0./)/)

  wks = gsn_open_wks("png", "synop chart")
  gsn_define_colormap(wks, cmap)

  mpres = True

  mpres@gsnMaximize = True
  mpres@gsnFrame = False
  mpres@mpLimitMode = "Corners"
  mpres@mpLeftCornerLonF = 125.
  mpres@mpRightCornerLonF = 130.
  mpres@mpLeftCornerLatF = 32.
  mpres@mpRightCornerLatF = 39.

  mpres@mpGeophysicalLineColor = "Black"
  mpres@mpGeophysicalLineThicknessF = 1.5
  mpres@mpOceanFillColor = "lightcyan"
  mpres@mpLandFillColor = "lightyellow"

  mpres@mpDataBaseVersion      = "HighRes"
  mpres@mpDataResolution       = "FinestResolution"
  mpres@mpDataSetName          = "Earth..4"

  mpres@mpGridAndLimbOn        = True
  mpres@mpGridAndLimbDrawOrder = "Draw"
  mpres@mpOutlineOn           = True
  mpres@mpNationalLineThicknessF = 2.0
  mpres@mpGridLatSpacingF         = 1
  mpres@mpGridLonSpacingF         = 1
  mpres@mpGridLineThicknessF   = 1.5

  map = gsn_csm_map(wks, mpres)

  wmsetp("wbs", 0.06)

  wmbarbmap(wks, 42., -99., 0., -15.)

  wmsetp("ezf", 1)
  wmstnm(wks, city_lats, city_lons, imdat)

  frame(wks)
end

그리고 결과물입니다

지역은 수도인 서울과 제가 있는 강릉, 전라남도의 광주, 경상남도의 부산, 제주특별자치도

 

이렇게 5개의 지역을 정했습니다

 

색상은 분석일기도 색상을 최대한 참고했습니다

728x90