?? create_fake_mod35.pro
字號:
PRO CREATE_FAKE_MOD35, MOD021KM, MOD35, MOD35QA, OUTFILE;+; Creates a fake MOD35 HDF file that can fool the McIDAS MOD35 ADDE server.; The ADDE server reads only the following SDS arrays from a MOD35 HDF file:; 'Latitude', 'Longitude', 'Cloud_Mask', 'Quality_Assurance';; MOD021KM Name of input MOD021KM HDF file (from DAAC or IMAPP); MOD35 Name of input MOD35 binary file (from DB version of cloud mask); MOD35QA Name of input MOD35QA binary file (from DB version of cloud mask); OUTFILE Name of output MOD35 HDF file (fake version);-;- Check argumentsif (n_elements(mod021km) eq 0) then message, 'Argument MOD021KM is undefined'if (n_elements(mod35) eq 0) then message, 'Argument MOD35 is undefined'if (n_elements(mod35qa) eq 0) then message, 'Argument MOD35QA is undefined'if (n_elements(outfile) eq 0) then message, 'Argument OUTFILE 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 cloud mask data from the MOD35 image fileopenr, lun, mod35, /get_lunmask = bytarr(nx, ny, 6)readu, lun, maskfree_lun, lun;- Get the quality assurance data from the MOD35QA image fileopenr, lun, mod35qa, /get_lunmaskqa = bytarr(nx, ny, 10)readu, lun, maskqafree_lun, lun;- Rearrange the quality assurance data in the required ordermaskqa = transpose(maskqa, [2, 0, 1]);-------------------------------------------------------------------------------; WRITE OUTPUT;-------------------------------------------------------------------------------;- Open the output HDF filehdfid = hdf_sd_start(outfile, /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 cloud maskvarid = hdf_sd_create(hdfid, 'Cloud_Mask', size(mask, /dimensions), /byte)hdf_sd_adddata, varid, maskhdf_sd_attrset, varid, 'units', 'none'hdf_sd_attrset, varid, 'scale_factor', 1.0d0, /doublehdf_sd_attrset, varid, 'add_offset',0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 377], /bytehdf_sd_attrset, varid, '_FillValue', 0, /bytehdf_sd_endaccess, varid;- Write the quality assurancevarid = hdf_sd_create(hdfid, 'Quality_Assurance', size(maskqa, /dimensions), /byte)hdf_sd_attrset, varid, 'units', 'none'hdf_sd_attrset, varid, 'scale_factor', 1.0d0, /doublehdf_sd_attrset, varid, 'add_offset',0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 377], /bytehdf_sd_attrset, varid, '_FillValue', 0, /bytehdf_sd_adddata, varid, maskqahdf_sd_endaccess, varid;- Close the output HDF filehdf_sd_end, hdfidEND
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -