색칠 할 때 점 찍듯이 하는 법

32 views
Skip to first unread message

[KS서울날씨청] KS Meteorology

unread,
Oct 7, 2020, 5:03:26 AM10/7/20
to 대한민국 IDL/ENVI/SARScape 사용자 포럼
안녕하세요
현재 신뢰도 95, 99% 구간에 대해서 색칠을 따로 하는 작업을 하고 있습니다.
우선 if 함수를 통하여 추세에 대한 신뢰도 95, 99% 구간 정하는거까지는 했고 contour 시키는거까지는 성공하였습니다.

문제는 contour를 하면 그냥 색깔만 가득 칠해지는데, 저는 잉크를 절약하고자 색칠을 마치 점 찍듯이 되어 있게 하는 법을 알고 싶어서 질문을 올리게 되었습니다...

  read, a ;
for i= 0, 40 do begin
        n1= (i)*12 +a-1 ; I want data of month 'a'
       n2= (i)*12 +a-1
  T_850(*,*,i) = (t[*,*,0,0,n1:n2]*0.0013171981+268.73488)-273.15;850hpa Temp / 850= 0.00099713240+269.47198 / 1000=0.0013171981+268.73488  / 700hpa=0.00078493690+265.19379
  sH_850(*,*,i)= (q[*,*,0,0,n1:n2]*3.3603468e-07+0.011043429)*1e3;850hpa = *2.5479734e-07+0.0084698212 / 1000 =3.3603468e-07+ 0.011043429/ 700hpa = 1.9472175e-07+ 0.0065995841

endfor
stat_95 = fltarr(281, 201)
stat_99 = fltarr(281, 201)
stat_95(*,*) = 0
stat_99(*,*) = 0
real_95 = 1.0/(sqrt((41-2)/(1+T_CVF(0.025, 41-2)^2)))
real_99 = 1.0/(sqrt((41-2)/(1+T_CVF(0.005, 41-2)^2)))
 
 for x= 0, 280 do begin ; 60 cities
    for y= 0, 200 do begin

      korea_temp(x,y)= mean(T_850(x,y,*)) ; mean of 41 years
      korea_sh(x,y)= mean(sh_850(x,y,*))
 
   korea_temp_all = fltarr(41)
   korea_temp_all(*) = T_850(x,y,*)
   ;korea_temp_all = REFORM(korea_temp_all_temp, 1*1*41)
  
   korea_sh_all_sh = fltarr(41)
   korea_sh_all_sh(*) = sh_850(x,y,*)
   ;korea_sh_all = REFORM(korea_sh_all_sh, 1*1*41) 
 
      korea_regr= regress(year, korea_temp_all, chisq= chisq, const=const, correlation=corr)
      korea_regr_final(x,y) = string((korea_regr*10),format='(f7.3)')
   
      korea_sh_regr= regress(year, korea_sh_all_sh, chisq= chisq1, const=const1, correlation=corr1)
      korea_sh_regr_final(x,y) = string((korea_sh_regr*10),format='(f7.3)')
      korea_corr_final(x,y)= corr
      korea_corr_sh_final(x,y)= corr1
    if corr1 ge real_95 then begin ; corr1= sh
      stat_95(x, y) = 1
    endif
   
    if corr1 ge real_99 then begin ; corr1= sh
      stat_99(x, y) = 1
    endif
   
    endfor
    endfor
   

;print, stat_95(*,*)

  win= window(dimension= [1400, 1000])
  map= map('Lambert Conformal Conic', $
    limit= [20, 100, 70, 170] , $;
    margin= 0.15, /current, aspect_ratio=0, STANDARD_PAR1=30, STANDARD_PAR2=60)

    statistic_95_plus = CONTOUR(stat_95[*,*],longitude[*,*] , latitude[*,*], C_THICK= 1.7, $
      /overplot, C_VALUE=[0.9:1.1:0.1] , font_size= 20.1, font_style= 1, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
      C_LABEL_INTERVAL = 0.6, /fill, color= 'blue',GRID_UNITS='degrees');, shading=1, SHADE_RANGE= [50,50]

  statistic_99_plus = CONTOUR(stat_99[*,*],longitude[*,*] , latitude[*,*], C_THICK= 1.7, $
      /overplot, C_VALUE=[0.9:1.1:0.1] , font_size= 20.1, font_style= 1, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
      C_LABEL_INTERVAL = 0.6, /fill, color= 'red',GRID_UNITS='degrees');, shading=1, SHADE_RANGE=[50,50]

  fill = CONTOUR( korea_sh_regr_final[*,*],  longitude[*,*] , latitude[*,*], C_THICK=2, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
    overplot=map , font_size= 15.1, font_style= 1,C_LABEL_INTERVAL = [0.5, 0.9, 0.5], $
    C_VALUE= [-0.3:-0.1:0.1],GRID_UNITS='degrees', c_linestyle=2, color='black')
  fill2 = CONTOUR( korea_sh_regr_final[*,*],  longitude[*,*] , latitude[*,*], C_THICK=2, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
    overplot=map , font_size= 15.1, font_style= 1,C_LABEL_INTERVAL = [0.6, 0.9, 0.8,0.8], $
    C_VALUE= [0.1:3:0.1],GRID_UNITS='degrees', color='black')
   
    fill3 = CONTOUR( korea_sh_regr_final[*,*],  longitude[*,*] , latitude[*,*], C_THICK=2, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
    overplot=map , font_size= 15.1, font_style= 1,C_LABEL_INTERVAL = [0.6, 0.9, 0.8,0.8], $
    C_VALUE= [0.05:0.05],GRID_UNITS='degrees', color='black')
   
   fill4 = CONTOUR( korea_sh_regr_final[*,*],  longitude[*,*] , latitude[*,*], C_THICK=2, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
    overplot=map , font_size= 15.1, font_style= 1,C_LABEL_INTERVAL = [0.6, 0.9, 0.8,0.8], $
    C_VALUE= [-0.05:-0.05],GRID_UNITS='degrees', color='black', c_linestyle=2)
       
  c = CONTOUR( korea_sh_regr_final[*,*],  longitude[*,*] , latitude[*,*], C_THICK=3.3, C_LABEL_SHOW=1, c_use_label_ORIENTATION= 1, $
    C_LABEL_INTERVAL = 0.63, overplot=map, font_size= 20.1, font_style= 1, $
    C_VALUE= [0:0],color='black',GRID_UNITS='degrees')

  mc= mapcontinents(/countries, thick= 1.4, /hires)
  map.mapgrid.label_position=0
  map.mapgrid.grid_longitude=30
  map.mapgrid.GRID_LATITUDE= 5
  map['latitudes'].label_angle= -1
  map['latitudes'].label_show= 0
  map['20N'].label_show= 1
  map['70N'].label_show= 1
  map['longitudes'].label_angle= 0
  map.mapgrid.thick= 1.7
  map.mapgrid.font_size= 15
  map.mapgrid.transparency= 20
  map.horizon_linestyle=0 ;make a box line
  map.HORIZON_THICK=2
  map.HORIZON_color= 'black
  map.linestyle=1
  map.mapgrid.FONT_STYLE= 'bold'
  map['25N'].hide=1
  map['35N'].hide=1
  map['45N'].linestyle= 6
  map['55N'].hide=1
  map['65N'].hide=1
  map['45N'].label_show= 1
  map['120E'].label_angle= 349
  map['150E'].label_angle= 11
 
end

위와 같은 코드에서 stat_95, stat_99가 신뢰도 구간 색칠하는거에 해당됩니다.
저기서 shading =1 도 써 보고 shade_range= [50,50] 도 써서 픽셀 설정도 했었지만 색칠은 아무런 차이가 없었습니다.

어떻게 해야 점 찍듯이 색을 칠 할 수 있을지 알려주시면 감사하겠습니다 ㅠTemp Regr 1980-2020 May 500hpa Statistic.png

이상우

unread,
Oct 8, 2020, 3:03:05 AM10/8/20
to 대한민국 IDL/ENVI/SARScape 사용자 포럼
일단 CONTOUR 함수의 색상 채우는 기능에서는 말 그대로 빈 공간 없이 '색상을 채우는' 기능만 기본적으로 지원됩니다. 따라서 점들이 찍힌 패턴은 기본적으로는 지원되지 않습니다. 물론 그렇다고 완전히 불가능한 것은 아닙니다. 바로 C_FILL_PATTERN이라는 속성을 이용하는 방법이 있긴 합니다. 다만 이 방법을 사용하려면 패턴(Pattern)을 직접 만들어야 합니다. 즉 점찍힌 모양의 패턴을 비트맵 형식의 배열로 만드는 것이 필요합니다. 하지만 이 방법은 저도 아직 실제로 적용해본 적이 없어서 자세히는 모릅니다. 혹시 나중에라도 파악이 된다면 다시 알려드리도록 하겠습니다.

2020년 10월 7일 수요일 오후 6시 3분 26초 UTC+9에 jungji...@gmail.com님이 작성:

이상우

unread,
Oct 13, 2020, 3:36:23 AM10/13/20
to 대한민국 IDL/ENVI/SARScape 사용자 포럼
커스텀 패턴을 채우는 방법에 관해서는 IDL 유저들과 함께 공유하면 좋을 것 같아서 나름대로 정리해보았습니다. 아래 링크를 통해서 그 내용을 참조해보시기 바랍니다.



2020년 10월 8일 목요일 오후 4시 3분 5초 UTC+9에 이상우님이 작성:

[KS서울날씨청] KS Meteorology

unread,
Oct 19, 2020, 3:23:03 AM10/19/20
to 대한민국 IDL/ENVI/SARScape 사용자 포럼
정말 존경스럽습니다... 진짜 프로그래밍이라는건 불가능은 없어 보이네요... 단, 어렵고 시도가 좀 힘들 뿐이지만요.
항상 감사드립니다 박사님!

2020년 10월 13일 화요일 오후 4시 36분 23초 UTC+9에 lee....@gmail.com님이 작성:
Reply all
Reply to author
Forward
0 new messages