?? create_fake_mod04.pro
字號:
PRO CREATE_FAKE_MOD04, MOD021KM, MOD04, OUTFILE;+; Creates a fake MOD04 HDF file that can fool the McIDAS ADDE server.; The ADDE server reads only the following dimension sizes from the:; 'Latitude', 'Longitude', SDS's;; MOD021KM Name of input MOD021KM HDF file (from DAAC or IMAPP); MOD04 Name of input MOD04 binary file (from DB version of aerosol code); OUTFILE Name of output MOD04 HDF file (fake version);;-; Program originally written by Kathy Strabala 12 August 2004; ;- Check argumentsif (n_elements(mod021km) eq 0) then message, 'Argument MOD021KM is undefined'if (n_elements(mod04) eq 0) then message, 'Argument input MOD04 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;- Get the number of pixels and linesdims = size(lat, /dimensions)nx = 135ny = dims[1] * 5Lny = ny/10;- Get the profiles data from the flat fileopenr, lun, mod04, /get_lunaerosol = fltarr(nx, 14, ny)readu, lun, aerosolfree_lun, lun;- Latitude arraylat=fltarr(nx,1,ny)lat = aerosol(*,0,*) lat1 = reform(lat,nx,ny)loc=where(lat1 lt -300.0, count)if count gt 0 then lat1(loc) = -999.0;- Longitude arraylon=fltarr(nx,1,ny)lon = aerosol(*,1,*) lon1 = reform(lon,nx,ny)loc=where(lon1 lt -300.0, count)if count gt 0 then lon1(loc) = -999.0;- Aerosol Optical Depth Arrayao=intarr(nx,1,ny)ao = round(aerosol(*,2,*) * 1000.0 )aot = reform(ao,nx,ny)loc=where(aot eq -327680, count)if count gt 0 then aot(loc) = -9999;- Optical Depth Ratioad=intarr(nx,1,ny)ad = round(aerosol(*,3,*) * 1000.0 )adr = reform(ad,nx,ny)loc=where(adr eq -327680, count)if count gt 0 then adr(loc) = -9999;- Corrected Optical Depth Over Landcod = intarr(nx,3,ny)for i = 0 , 2, 1 do begin j = 4 + i cod(*,i,*) = round(aerosol(*,j,*) )endforloc=where(cod eq -328, count)for i = 0 , 2, 1 do begin j = 4 + i cod(*,i,*) = round(aerosol(*,j,*) * 1000.0 )endforif count gt 0 then cod(loc) = -9999;- Rearrange Arraycod_trans=transpose(cod,[0,2,1]);- Effective Optical Depth Oceaneod = intarr(nx,7,ny)for i = 0 , 6, 1 do begin j = 7 + i eod(*,i,*) = round(aerosol(*,j,*) )endforloc=where(eod eq -328, count)for i = 0 , 6, 1 do begin j = 7 + i eod(*,i,*) = round(aerosol(*,j,*) * 1000.0 )endforif count gt 0 then eod(loc) = -9999;- Rearrange Arrayeod_trans=transpose(eod,[0,2,1]);-------------------------------------------------------------------------------; WRITE OUTPUT;-------------------------------------------------------------------------------;- Open the output HDF filehdfid = hdf_sd_start(outfile, /create);- Write the profiles SDS's varid = hdf_sd_create(hdfid, 'Latitude', [nx, ny], /float)hdf_sd_adddata, varid, lat1hdf_sd_attrset, varid, 'units', 'Degrees_north'hdf_sd_attrset, varid, 'scale_factor', 1.0d, /double hdf_sd_attrset, varid, 'add_offset', 0.d0, /double hdf_sd_attrset, varid, 'valid_range', [-90.0, 90.0], /floathdf_sd_attrset, varid, '_FillValue', -999.0, /floathdf_sd_endaccess, varid;- Write the profiles SDS's varid = hdf_sd_create(hdfid, 'Longitude', [nx, ny], /float)hdf_sd_adddata, varid, lon1hdf_sd_attrset, varid, 'units', 'Degrees_east'hdf_sd_attrset, varid, 'scale_factor', 1.0d, /double hdf_sd_attrset, varid, 'add_offset', 0.d0, /double hdf_sd_attrset, varid, 'valid_range', [-180.0, 180.0], /floathdf_sd_attrset, varid, '_FillValue', -999.0, /floathdf_sd_endaccess, varid;- Write the profiles SDS's varid = hdf_sd_create(hdfid, 'Optical_Depth_Land_And_Ocean', [nx, ny], /short)hdf_sd_adddata, varid, aothdf_sd_attrset, varid, 'units', 'none'hdf_sd_attrset, varid, 'scale_factor', .001d0, /double hdf_sd_attrset, varid, 'add_offset', 0.d0, /double hdf_sd_attrset, varid, 'valid_range', [0, 5000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varid;- Write the profiles SDS's varid = hdf_sd_create(hdfid, 'Optical_Depth_Ratio_Small_Land_And_Ocean', [nx, ny], /short)hdf_sd_adddata, varid, adrhdf_sd_attrset, varid, 'units', 'none'hdf_sd_attrset, varid, 'scale_factor', .001d0, /double hdf_sd_attrset, varid, 'add_offset', 0.d0, /double hdf_sd_attrset, varid, 'valid_range', [0, 1000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Corrected_Optical_Depth_Land', size(cod_trans, /dimensions), /short)hdf_sd_adddata, varid, cod_transhdf_sd_attrset, varid, 'units', 'none'hdf_sd_attrset, varid, 'scale_factor', .001d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 5000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Effective_Optical_Depth_Average_Ocean', size(eod_trans, /dimensions), /short)hdf_sd_adddata, varid, eod_transhdf_sd_attrset, varid, 'units', 'none'hdf_sd_attrset, varid, 'scale_factor', .001d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 5000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varid;- Close the output HDF filehdf_sd_end, hdfidEND
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -