当前位置:网站首页>IDL reads HSD data of sunflower 8 (himawari-8)
IDL reads HSD data of sunflower 8 (himawari-8)
2022-07-27 09:17:00 【A big stupid pig】
It can realize direct input .DAT file , Read and obtain the image after calibration 、 Time 、 Three arrays of sun positions
inputfile by .DAT file , for example HS_H08_20170623_0250_B01_FLDK_R10_S0110.DAT
resolution by HS_H08_20170623_0250_B01_FLDK_R The number after , Represents the resolution
The code will automatically calibrate the data accordingly ( The visible light band is calibrated as the apparent reflectance , Infrared calibration is brightness temperature )
The time turns to double type , Prevent trouble later
Will 500m The band is sampled to one kilometer , Then divide the data by resolution , Merge
; Input folder ( Store all DAT file ) And pretreatment
Function H8_Preprocess,inputfolder=inputfolder,e=e
COMPILE_OPT idl2
R10_data=make_array(11000,11000,4,/FLOAT)
R20_data=make_array(5500,5500,12,/FLOAT)
bandnames=['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16']
for i=0,15 do begin
band_files=file_search(inputfolder,'*B'+bandnames[i]+'_FLDK*.DAT',/test_regular)
if N_ELEMENTS(band_files) EQ 10 THEN BEGIN
band_data=[]
obstime=[]
sunpos=[]
for j=0,9 do begin
infile=band_files[j]
segment=read_hsd(inputfile=infile[0])
imgdata=segment['pixels']
imgtime=segment['time']
sun_pos=segment['sun_pos']
band_data=[[band_data],[imgdata]]
obstime=[[obstime],[imgtime]]
sunpos=[[sunpos],[sun_pos]]
; Destroy hash table
OBJ_DESTROY,segment
endfor
if i lt 2 then begin
R10_data[*,*,i]=band_data
R10_obstime=obstime
R10_sunpos=sunpos
endif else if i eq 2 then begin
band_raster=ENVIRaster(band_data,URI=e.GetTemporaryFilename(CLEANUP_ON_EXIT='True'))
band_raster.Save
sampleRaster=ENVIResampleRaster(band_raster, DIMENSIONS=[11000,11000])
band_data=sampleRaster.GetData()
sampleRaster.Close
band_raster.Close
R10_data[*,*,i]=band_data
endif else if i lt 4 then begin
R10_data[*,*,i]=band_data
endif else begin
R20_data[*,*,i-4]=band_data
R20_obstime=obstime
R20_sunpos=sunpos
endelse
endif
endfor
outdata=hash('R10',R10_data,'R10_time',R10_obstime,'R10_sunpos',R10_sunpos,'R20',R20_data,'R20_time',R20_obstime,'R20_sunpos',R20_sunpos)
return,outdata
END
; Read HSD Data and scale as albedo/BT
Function read_hsd,inputfile=inputfile
COMPILE_OPT idl2
spli=strsplit(file_basename(inputfile),'_')
; Get resolution
resolution=fix(strmid(file_basename(inputfile),spli[6]+1,2))
if resolution eq 5 then begin
cols=22000
rows=2200
endif else if resolution eq 10 then begin
cols=11000
rows=1100
endif else if resolution eq 20 then begin
cols=5500
rows=550
endif
openr,h8_lun,inputfile,/get_lun
; obtain Observation start time
point_lun,h8_lun,46
imgtime=dblarr(1);R8
readu,h8_lun,imgtime
; obtain Total header length
point_lun,h8_lun,70
header_length=uintarr(1);I4
readu,h8_lun,header_length
; Get images
point_lun,h8_lun,header_length
imgdata=uintarr(cols,rows)
readu,h8_lun,imgdata
; obtain Sun's position
point_lun,h8_lun,510
sun_pos=dblarr(3);R8
readu,h8_lun,sun_pos
; obtain Band number
point_lun,h8_lun,601
band=uintarr(1);I2
readu,h8_lun,band
; obtain Gain
point_lun,h8_lun,617
Gain=dblarr(1);R8
readu,h8_lun,Gain
; obtain Offset
point_lun,h8_lun,625
Offset=dblarr(1);R8
readu,h8_lun,Offset
; Calculation radiance
radiance=imgdata*Gain[0]+Offset[0]
if band le 6 then begin; Calculate reflectivity
; obtain radiance to albedo
point_lun,h8_lun,633
cc=dblarr(1);R8
readu,h8_lun,cc
; Calculate reflectivity
albedo=radiance*cc[0]
; Return value outdata
outdata=albedo
endif else begin; Calculated brightness temperature
; obtain Central wave length
point_lun,h8_lun,603
wv=dblarr(1);R8
readu,h8_lun,wv
; obtain radiance to brightness temperature(c0)
point_lun,h8_lun,633
c0=dblarr(1);R8
readu,h8_lun,c0
; obtain radiance to brightness temperature(c1)
point_lun,h8_lun,641
c1=dblarr(1);R8
readu,h8_lun,c1
; obtain radiance to brightness temperature(c2)
point_lun,h8_lun,649
c2=dblarr(1);R8
readu,h8_lun,c2
; obtain Speed of light (c)
point_lun,h8_lun,681
c=dblarr(1);R8
readu,h8_lun,c
; obtain Planck constant (h)
point_lun,h8_lun,689
h=dblarr(1);R8
readu,h8_lun,h
; obtain Boltzmann constant(k)
point_lun,h8_lun,697
k=dblarr(1);R8
readu,h8_lun,k
; Calculated brightness temperature
wv=wv[0]*1e-6
rad=radiance*1e6
Te=h[0]*c[0]/k[0]/wv[0]/(ALOG(2*h[0]*c[0]^2/(wv[0]^5*rad)+1))
BT=c0[0]+c1[0]*Te+c2[0]*Te^2
; Return value outdata
outdata=BT
endelse
free_lun,h8_lun
; return :albedo/BT, Time , Solar coordinates
obstime=make_array(cols,rows,value=imgtime[0]*1.0d)
sunpos=make_array(cols,rows,3,/float)
sunpos[*,*,0]=make_array(cols,rows,value=sun_pos[0])
sunpos[*,*,1]=make_array(cols,rows,value=sun_pos[1])
sunpos[*,*,2]=make_array(cols,rows,value=sun_pos[2])
out=hash('pixels',outdata,'time',obstime,'sun_pos',sunpos)
return,out
END
边栏推荐
猜你喜欢

npm install报错 强制安装

Five kinds of 3D attention/transformer finishing (a-scn, point attention, CAA, offset attention, point transformer)

Pytorch custom CUDA operator tutorial and runtime analysis

Music experience ceiling! Emotional design details of 14 Netease cloud music

C language takes you to tear up the address book

PyTorch自定义CUDA算子教程与运行时间分析

对 int 变量赋值的操作是原子的吗?

软件测试功能测试全套常见面试题【功能测试-零基础】必备4-1

Understand various IOU loss functions in target detection

ES6 new symbol data type
随机推荐
Nut weather
[C language - zero foundation lesson 11] rotate the pointer of the big turntable
645. Wrong set
网易笔试之解救小易——曼哈顿距离的典型应用
STL container -- Application of set set
Pymongo fuzzy query
The fourth day of learning C language
STL container - basic operation of queue and deque
【云驻共创】华为云:全栈技术创新,深耕数字化,引领云原生
Music experience ceiling! Emotional design details of 14 Netease cloud music
8 kinds of visual transformer finishing (Part 2)
[acl2020] a novel method of component syntax tree serialization
Is the operation of assigning values to int variables atomic?
[C language - zero foundation lesson 9] love and hate in functions
Linux Installation and remote connection MySQL records
Intel, squeezed by Samsung and TSMC, finally put down its body to customize chip technology for Chinese chips
Analog library function
Programming style
Primary function t1744963 character writing
CUDA Programming -03: thread level