file_ID = NCDF_OPEN(theseFiles[fidx],/NOWRITE) ;open netCDF file for READ only
Tag = NCDF_INQUIRE(file_ID)
timeid = NCDF_VARID(file_ID,'time') ;initial_time0initial_time0_hours initial_time0
NCDF_VARGET, file_ID, timeid, time ;獲取 時間維變量
nt = N_ELEMENTS(time)
;print,time
latid = NCDF_VARID(file_ID,'latitude') ;g0_lat_2
NCDF_VARGET, file_ID, latid, latitude ;獲取 時間維變量
nlat = N_ELEMENTS(latitude) ;緯向維長度
;print,'dsklfjdsjfkldjsfkljl'+latitude
lonid = NCDF_VARID(file_ID,'longitude') ;g0_lon_3
NCDF_VARGET, file_ID, lonid, longitude ;獲取 時間維變量
nlon = N_ELEMENTS(longitude) ;徑向維長度
t2mid = NCDF_VARID(file_ID,'t2m') ;g0_lon_3
NCDF_VARGET, file_ID, t2mid, t2m ;獲取 溫度維變量
nt2m = N_ELEMENTS(t2m)
ncdf_attget,file_ID,t2mid,'scale_factor',a
ncdf_attget,file_ID,t2mid,'add_offset',b
year=STRMID(thesefiles[fidx],0,4)
month=STRMID(thesefiles[fidx],5,2)
outtmp=fltarr(480,15,band[fidx]*4)
outtmp[*,*,*]=t2m[*,*,*]*a+b
NCDF_CLOSE, file_ID
print,' All parameters of file ' + thesefiles[fidx] + ' have been writen out!'
outfilename = STRCOMPRESS(outfilepath +string(year,FORMAT='(I04)')+'_'+string(month,FORMAT='(I02)'),/remove_all)
openw,var_lun,outfilename,/get_lun
writeu,var_lun,outtmp;
close,var_lun
free_lun,var_lun
scale_factor','add_offset一定要注意獲取,也要注意最後讀取出來的單位。