?? create_fake_mod07.pro
字號(hào):
PRO CREATE_FAKE_MOD07, MOD021KM, MOD07, OUTFILE;+; Creates a fake MOD07 HDF file that can fool the McIDAS ADDE server.; The ADDE server reads only the following SDS arrays from a MOD07 HDF file:; 'Latitude', 'Longitude', 'PARAMETER';; MOD021KM Name of input MOD021KM HDF file (from DAAC or IMAPP); MOD07 Name of input MOD07 binary file (from DB version of profiles); OUTFILE Name of output MOD07 HDF file (fake version);;-; Program originally written by Kathy Strabala 8/30/2002; ;- Check argumentsif (n_elements(mod021km) eq 0) then message, 'Argument MOD021KM is undefined'if (n_elements(mod07) eq 0) then message, 'Argument input MOD07 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 profiles data from the flat fileopenr, lun, mod07, /get_lunctp = fltarr(nx/5, 83, ny/5)readu, lun, ctpfree_lun, lunbt=intarr(nx/5,12,ny/5)for i = 0 , 11, 1 do begin bt(*,i,*) = round(ctp(*,i,*) * 100. - 15000. )endfor;- Rearrange Brightness Temperature array loc=where(bt eq 17768, count)if count gt 0 then bt(loc) = -32768brite=transpose(bt,[0,2,1]);- Surface Temperaturesfctemp=intarr(nx/5,1,ny/5)sfctemp=round(ctp(*,12,*) * 100. - 15000. )sfct=reform(sfctemp,nx/5,ny/5)loc=where(sfct eq -47768, count)if count gt 0 then sfct(loc) = -32768;- Surface Pressuresfcpres=intarr(nx/5,1,ny/5)sfcpres=round(ctp(*,13,*) * 10.)sfcp=reform(sfcpres,nx/5,ny/5)loc=where(sfcp lt 0, count)if count gt 0 then sfcp(loc) = -32768;- Surface Elevation;- Note: you will have a fill value in place of the actual;- value if the elevation turns out to be -328 m. This ;- should be the only time there is a problem.sfcelev=intarr(nx/5,1,ny/5)sfcelev=round(ctp(*,14,*))sfc_elev=reform(sfcelev,nx/5,ny/5)loc=where(sfc_elev eq -328, count)if count gt 0 then sfc_elev(loc) = -32768;- Retrieved Temperature Profilerett=intarr(nx/5,20,ny/5)for i = 0 , 19, 1 do begin j = 15 + i rett(*,i,*) = round(ctp(*,j,*) * 100. - 15000. )endforloc=where(rett eq 17768, count)if count gt 0 then rett(loc) = -32768;- Rearrange Arrayret_temp=transpose(rett,[0,2,1]);- Retrieved Moisture Profileretm=intarr(nx/5,20,ny/5)for i = 0 , 19, 1 do begin j = 35 + i retm(*,i,*) = round(ctp(*,j,*) * 100. - 15000. )endforloc=where(retm eq 17768, count)if count gt 0 then retm(loc) = -32768;- Rearrange Arrayret_mois=transpose(retm,[0,2,1]);- Retrieved Height Profilereth=intarr(nx/5,20,ny/5)for i = 0 , 19, 1 do begin j = 55 + i reth(*,i,*) = round(ctp(*,j,*) - 32500. )endforloc=where(reth eq 32708, count)if count gt 0 then reth(loc) = -32768;- Rearrange Arrayret_height=transpose(reth,[0,2,1]);- Total Ozonetoz=intarr(nx/5,1,ny/5)toz=round(ctp(*,75,*) * 10. )tot_oz=reform(toz,nx/5,ny/5) loc=where(tot_oz lt 0, count)if count gt 0 then tot_oz(loc) = -32768;- Total Totalstt=intarr(nx/5,1,ny/5)tt=round(ctp(*,76,*) * 100. )totals=reform(tt,nx/5,ny/5)loc=where(totals lt 0, count)if count gt 0 then totals(loc) = -32768;- Lifted Indexli=intarr(nx/5,1,ny/5)li=round(ctp(*,77,*) * 100. )lift=reform(li,nx/5,ny/5)loc=where(lift lt -2000, count)if count gt 0 then lift(loc) = -32768;- K Indexki=intarr(nx/5,1,ny/5)ki=round(ctp(*,78,*) * 100. )kindex=reform(ki,nx/5,ny/5)loc=where(kindex lt 0, count)if count gt 0 then kindex(loc) = -32768;- Total column WVtwv=intarr(nx/5,1,ny/5)twv=round(ctp(*,79,*) * 1000. )totwv=reform(twv,nx/5,ny/5)loc=where(totwv lt 0, count)if count gt 0 then totwv(loc) = -9999;- Direct WVdwv=intarr(nx/5,1,ny/5)dwv=round(ctp(*,80,*) * 1000. )dirwv=reform(dwv,nx/5,ny/5) loc=where(dirwv lt 0, count)if count gt 0 then dirwv(loc) = -9999;- Water Vapor Lowlwv=intarr(nx/5,1,ny/5)lwv=round(ctp(*,81,*) * 1000. )wv_low=reform(lwv,nx/5,ny/5)loc=where(wv_low lt 0, count)if count gt 0 then wv_low(loc) = -9999;- Water Vapor Lowhwv=intarr(nx/5,1,ny/5)hwv=round(ctp(*,82,*) * 1000. )wv_high=reform(hwv,nx/5,ny/5)loc=where(wv_high lt 0, count)if count gt 0 then wv_high(loc) = -9999;-------------------------------------------------------------------------------; 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 profiles SDS's varid = hdf_sd_create(hdfid, 'Brightness_Temperature', size(brite, /dimensions), /int)hdf_sd_adddata, varid, britehdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', .01d0, /double hdf_sd_attrset, varid, 'add_offset', -15000., /double hdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Surface_Temperature', size(sfct, /dimensions), /int)hdf_sd_adddata, varid, sfcthdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', .01d0, /doublehdf_sd_attrset, varid, 'add_offset', -15000., /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Surface_Pressure', size(sfcp, /dimensions), /int)hdf_sd_adddata, varid, sfcphdf_sd_attrset, varid, 'units', 'hPa'hdf_sd_attrset, varid, 'scale_factor', .1d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0, /doublehdf_sd_attrset, varid, 'valid_range', [8000, 11000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Surface_Elevation', size(sfc_elev, /dimensions), /int)hdf_sd_adddata, varid, sfc_elevhdf_sd_attrset, varid, 'units', 'm'hdf_sd_attrset, varid, 'scale_factor', 1.0d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0, /doublehdf_sd_attrset, varid, 'valid_range', [-400, 8840], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Retrieved_Temperature_Profile', size(ret_temp, /dimensions), /int)hdf_sd_adddata, varid, ret_temphdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', 0.01d0, /doublehdf_sd_attrset, varid, 'add_offset', -15000.0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Retrieved_Moisture_Profile', size(ret_mois, /dimensions), /int)hdf_sd_adddata, varid, ret_moishdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', 0.01d0, /doublehdf_sd_attrset, varid, 'add_offset', -15000.0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Retrieved_Height_Profile', size(ret_height, /dimensions), /int)hdf_sd_adddata, varid, ret_heighthdf_sd_attrset, varid, 'units', 'm'hdf_sd_attrset, varid, 'scale_factor', 1.0d0, /doublehdf_sd_attrset, varid, 'add_offset', -32500.0, /doublehdf_sd_attrset, varid, 'valid_range', [-32500, 32500], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Total_Ozone', size(tot_oz, /dimensions), /int)hdf_sd_adddata, varid, tot_ozhdf_sd_attrset, varid, 'units', 'Dobson'hdf_sd_attrset, varid, 'scale_factor', 0.1d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 5000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Total_Totals', size(totals, /dimensions), /int)hdf_sd_adddata, varid, totalshdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', 0.01d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 8000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Lifted_Index', size(lift, /dimensions), /int)hdf_sd_adddata, varid, lifthdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', 0.01d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [-2000, 4000], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'K_Index', size(kindex, /dimensions), /int)hdf_sd_adddata, varid, kindexhdf_sd_attrset, varid, 'units', 'K'hdf_sd_attrset, varid, 'scale_factor', 0.01d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [-500, 6500], /shorthdf_sd_attrset, varid, '_FillValue', -32768, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Water_Vapor', size(totwv, /dimensions), /int)hdf_sd_adddata, varid, totwvhdf_sd_attrset, varid, 'units', 'cm'hdf_sd_attrset, varid, 'scale_factor', 0.001d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Water_Vapor_Direct', size(dirwv, /dimensions), /int)hdf_sd_adddata, varid, dirwvhdf_sd_attrset, varid, 'units', 'cm'hdf_sd_attrset, varid, 'scale_factor', 0.001d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Water_Vapor_Low', size(wv_low, /dimensions), /int)hdf_sd_adddata, varid, wv_lowhdf_sd_attrset, varid, 'units', 'cm'hdf_sd_attrset, varid, 'scale_factor', 0.001d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varidvarid = hdf_sd_create(hdfid, 'Water_Vapor_High', size(wv_high, /dimensions), /int)hdf_sd_adddata, varid, wv_highhdf_sd_attrset, varid, 'units', 'cm'hdf_sd_attrset, varid, 'scale_factor', 0.001d0, /doublehdf_sd_attrset, varid, 'add_offset', 0.0d0, /doublehdf_sd_attrset, varid, 'valid_range', [0, 20000], /shorthdf_sd_attrset, varid, '_FillValue', -9999, /shorthdf_sd_endaccess, varid;- Close the output HDF filehdf_sd_end, hdfidEND
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -