- This topic has 1개 답변, 2명 참여, and was last updated 6 years, 11 months 전에 by Sangwoo.
-
글쓴이글
-
-
Limdae회원
pro final_work_aod_mean
longitude = fltarr(360,160)
latitude = fltarr(360,160)pixel_size= 0.25
for c=0, 359 do begin
for d=0, 159 do beginlatitude[c,d] = 10.125 + pixel_size * d
longitude[c,d] = 80.125 + pixel_size * cendfor
endforfile = file_search(‘/D:/Users/E6550/Desktop/MODIS ‘, count = file_num) ;인풋파일 경로 설정
year_modis = strarr(file_num)
month_modis = strarr(file_num)
day_modis = strarr(file_num)length = strlen(file[0])
for i =0, file_num-1 do begin
year_modis[i] = strmid(file[i], length-12, 4)
month_modis[i] = strmid(file[i], length-8, 2)
day_modis[i] = strmid(file[i], length-6, 2)endfor
for year = 2005, 2016 do begin
for month = 1, 12 do beginfind_days_modis = where(year eq year_modis and month eq month_modis, num_days)
dimen_aod = fltarr(360, 160, num_days)for i=0, num_days -1 do begin
file_days_modis = hdf_sd_start(file[find_days_modis[i]], /read)
hdf_sd_readonly, file_days_modis, ‘AOD’, aodhdf_sd_end, file_days_modis
dimen_aod[*,*,i] = aod[*,*,0]
endfor
mean_aod = fltarr(360,160)
for lon = 0, 359 do begin
for lat = 0, 159 do beginmean_aod[lon,lat] = mean(dimen_aod[lon, lat, *], /nan)
endfor
endfordevice, decomposed = 0
LoadCT,39
window, 0, xsize = 1000, ysize = 600
erase, -1limits = [20, 100, 50, 150]
map_set, limit = limits, color = 0, xmargin = [10, 10], ymargin = [10, 5], /noerase;, title = ‘SO2’
map_grid, /box, latdel = 5, londel = 5, charsize = 2, color = 0LoadCT,22
COLORBAR,POSITION = [0.1, 0.05, 0.9, 0.08], color = -1, $
minrange = 0 ,maxrange = 2.0, DIVISIONS = 6, format = ‘(f3.1)’, charsize = 1.5
;,title = ‘DU’;, format = ‘(e10)’bt = bytscl(mean_aod, min=0.0, max = 2.0, /NaN, top=254)
b = .125
for l=0,359 do begin
for m = 0, 159 do begin
ybox = [latitude[l,m] – b,latitude[l,m] – b,latitude[l,m] + b,latitude[l,m] + b]
xbox = [longitude[l,m] – b,longitude[l,m] + b,longitude[l,m] + b,longitude[l,m] – b]
polyfill, xbox, ybox, color = bt[l,m]
endfor
endforLoadCT,39
map_continents, /noerase, /CONTINENTS, COLOR = 0 , /hires, /coastssOutput_jpg = ‘/D:/Users/E6550/Desktop/123’ + string(year, format = ‘(i4)’) + string(month, format = ‘(i2)’) + ‘.jpg’ ;아웃풋파일 경로 설정
image = tvrd(true = 1)
write_jpeg, sOutput_jpg, image, true = 1, quality = 100endfor
endforend
————————————————————————————————–
실행시
IDL> .COMPILE “D:\Users\E6550\Desktop\가마우지\Desktop\final_work_aod_mean.pro”
Compiled module: FINAL_WORK_AOD_MEAN.
IDL> final_work_aod_mean
Array dimensions must be greater than 0.
Execution halted at: FINAL_WORK_AOD_MEAN 18 D:\Users\E6550\Desktop\가마우지\Desktop\final_work_aod_mean.pro
$MAIN$라는 오류가 뜹니다. 초보자라 어떤걸 수정해야 되는지 잘모르겠네요,
-
Sangwoo회원
FILE_SEARCH 함수에서 COUNT 키워드로 얻은 file_num의 값이 0이 나왔단 얘기입니다. 그래서 STRARR(0)이 실행된 것인데, 배열을 만들면서 갯수가 0이라고 하니 에러가 난 상황인데요. 즉, FILE_SEARCH 함수로 검색된 파일이 하나도 없다는 뜻입니다. FILE_SEARCH 함수 내부를 보면 드라이브명인 D앞에 / 기호가 붙어있는데 이게 문제가 된 것 같습니다. / 기호를 제거한 후 진행해보시기 바랍니다. 그리고 file_num의 값이 0이 아닌지를 먼저 확인함으로써, 파일들이 제대로 검색이 되었는가 여부를 체크한 후 후속 단계가 진행되도록 하는 것이 좋겠습니다.
-
-
글쓴이글