?? create_wvnir_hdf.pro
字號:
PRO CREATE_WVNIR_HDF, MOD021KM, WVNIR_BIN, WVNIR_HDF;+; Creates a fake near-infrared water vapor HDF file;; MOD021KM Name of input MOD021KM HDF file (from DAAC or IMAPP); WVNIR_BIN Name of input water vapor nir binary file (from DB software); WVNIR_HDF Name of output water vapor nir HDF file ;;-; Program originally written by Kathy Strabala 10/13/2004; ;- Check argumentsif (n_elements(mod021km) eq 0) then message, 'Argument MOD021KM is undefined'if (n_elements(wvnir_bin) eq 0) then message, 'Argument input WVNIR_BIN is undefined'if (n_elements(wvnir_hdf) eq 0) then message, 'Argument output WVNIR_HDF is undefined' ;-------------------------------------------------------------------------------; READ INPUT;-------------------------------------------------------------------------------;- Read the lat/lon data from the MOD021KM filehdfid = hdf_sd_start(mod021km)hdf_sd_varread, hdfid, 'Latitude', lathdf_sd_varread, hdfid, 'Longitude', lonhdf_sd_end, hdfid;- Remove the last value from each rowlat = lat[0:269, *]lon = lon[0:269, *];- Get the number of pixels and linesdims = size(lat, /dimensions)nx = 1354ny = dims[1]*5L ;- Get the data from the flat fileopenr, lun, (wvnir_bin), /get_lunwvnir = fltarr(nx, ny)readu, lun, wvnirfree_lun, lun;-------------------------------------------------------------------------------; WRITE OUTPUT;-------------------------------------------------------------------------------;- Open the output HDF filehdfid = hdf_sd_start(wvnir_hdf, /create);- Write the latitudevarid = hdf_sd_create(hdfid, 'Latitude', size(lat, /dimensions), /float)hdf_sd_adddata, varid, lathdf_sd_endaccess, varid;- Write the longitudevarid = hdf_sd_create(hdfid, 'Longitude', size(lon, /dimensions), /float)hdf_sd_adddata, varid, lonhdf_sd_endaccess, varid;- Write the near infrared water vapor arrayvarid = hdf_sd_create(hdfid, 'Water_Vapor_Direct_Broadcat_Near_Infrared', size(wvnir, /dimensions), /float)hdf_sd_adddata, varid, wvnirhdf_sd_attrset, varid, 'units', 'kg/m2'hdf_sd_attrset, varid, 'scale_factor', 1.0d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, '_FillValue', -1.0, /floathdf_sd_endaccess, varid;- Close the output HDF filehdf_sd_end, hdfidEND
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -