X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 02 Jun 2007 12:18 PM by  anon
Getting Fraction of diffuse light (Fdl)values from Skyl_lut.dat table
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
02 Jun 2007 12:18 PM
    I have been thinking about calculating Actual albedo (Aa) with white sky albedo (Albedo_ws) and black sky albedo (Albedo_bs) retrieved from MODIS43 image for several days. As many of you may know, MODIS43 images have only Albedo_ws and Albedo_bs info, and we need additional value, fraction of diffuse light (Fdl), to calculate Aa. If these values are ready we can calculate Aa this way. Aa = Albedo_ws * Fdl + Albedo_bs * (1-Fdl) Fdl values are provided through the skyl_lut.dat table and the contents are as follows. 2 aerosol types 10 bands (7 MODIS bands + 3 broad bands (VIS, NIR, SW) 90 degrees (0-89 degrees with 1 degree step 50 optical depth ( 0-1 with 0.02 step) The table shown below is a part of skyl_lut.dat. I made this just for testing. ; Skyl_lut.dat00.dat Aerosol_type: Continental MODIS_Band_1: (0.620,0.670) S&O 0.00 0.02 0.04 0.06 0.08 0.10 0 0.029 0.042 0.055 0.067 0.079 0.091 1 0.029 0.042 0.055 0.067 0.079 0.091 2 0.029 0.042 0.055 0.067 0.079 0.091 3 0.029 0.042 0.055 0.067 0.079 0.091 4 0.029 0.042 0.055 0.067 0.079 0.092 MODIS_Band_2: (0.841,0.876) S&O 0.00 0.02 0.04 0.06 0.08 0.10 0 0.016 0.027 0.037 0.047 0.057 0.067 1 0.016 0.027 0.037 0.047 0.057 0.067 2 0.016 0.027 0.037 0.047 0.057 0.067 3 0.016 0.027 0.037 0.047 0.057 0.067 4 0.016 0.027 0.037 0.047 0.057 0.067 Aerosol_type: Maritime MODIS_Band_1: (0.620,0.670) S&O 0.00 0.02 0.04 0.06 0.08 0.10 0 0.029 0.046 0.063 0.080 0.096 0.112 1 0.029 0.046 0.063 0.080 0.096 0.112 2 0.029 0.046 0.063 0.080 0.096 0.112 3 0.029 0.046 0.063 0.080 0.096 0.113 4 0.029 0.047 0.064 0.080 0.097 0.113 MODIS_Band_2: (0.841, 0.876) S&O 0.00 0.02 0.04 0.06 0.08 0.10 0 0.016 0.035 0.054 0.072 0.089 0.106 1 0.016 0.035 0.054 0.072 0.089 0.106 2 0.016 0.035 0.054 0.072 0.089 0.106 3 0.016 0.035 0.054 0.072 0.089 0.106 4 0.016 0.035 0.054 0.072 0.089 0.107 I found a C code tell.skyl.c and I posted it several days ago. (No one replied (T.T)... Maybe the questions was too broad... I think. anyway) After I compiled it, I got tell_sky.exe and tested it with spawn statements like this. ------------------ pro test_spawn dir='C:\Documents and Settings\Yi\harry' cmd='tell_skyl.exe' option=' -od 0.2 -szn 30.0' cd, dir print, cmd+option spawn, cmd+option, result ----------------------- However, my knowledge on C is limited. I believe that trying with IDL is less time-consuming and simpler for me. Now¡¦ I am reading this table with structure in IDL, because this table has different format of data and I have a feeling that structure is the one of the best solutions to read this table. Therefore, I began this way S1 = {Fdl, solza, nb, AOT2, amt} ; where ; Fdl = Fraction of diffuse light ; solza = solar zenith angle: 90 degrees. À§ÀÇ µµÇ¥¿¡¼­´Â 5°³¸¸ (0~4) ; nb = band number: 10 wavelengths À§¿¡¼± 2°³¸¸ (band 1, 2) ; AOT2 = aerosol optical Thichness (depth) at 0.55 À§¿¡¼± 6°³¸¸ (0.00 ~ 0.10) ; amt = aerosol model type: 2 (continental/ maritime) what I want to do now is to read the Fdl values from Skyl_lut00.dat. If input variables are as follows, how can I get the Fdl values from Skyl_lut00? Fdlinput.txt ; solza, nb, AOT2, amt 30 10 0.04 continental 40 9 0.5 continental 55 5 0.4 continental 39 8 0.3 maritime 77 7 0.2 maritime Sorry everyone if I bothered you. Harry

    Deleted User



    New Member


    Posts:
    New Member


    --
    02 Jun 2007 12:18 PM
    Harry, Extrapolating from the approach taken by the C library you mentioned in your original message thread, I provide below the approximate equivalent of that parser as it could be written in the IDL language. To run this you would use the syntax: IDL> fdlArray = PARSE_MODIS_FDL(numberOfAerosolTypes, $ IDL> numberOfBands, numberOfSZADegrees) Each element of the result array would have the following structure: fdl[opticalDepthIndex, szaDegreeIndex, bandNumberIndex, aerosolTypeIndex] The function assumes that there is no other header info than what you gave in your abbreviated example data. I.e. this function assumes that the first line in the file is the line demarcating the first Aerosol Type, the second and third lines are the lines demarcating the band number info and the optical info for the first block of FDL values. It is easy to modify, if you know how to use READF at the beginning of a file to move the "file cursor" to the beginning of the first line in the file that IS the first Aerosol Type info line. Hope that it is not hard to figure out the code steps below. James Jones FUNCTION parse_modis_fdl, file, nAerosolTypes, nBands, nSZAs ;nAerosolTypes = 2 ; Values from Harry Kim's User Forum example ;nBands = 2 ;nOpticalDepths = 5 ;nSZAs = 5 ; Parse the first Optical Depth Header Line to dynamically set ; the number of optical depths in the FDL array nLines = file_lines(file) textArray = strarr(nLines) openr, lun, file, /GET_LUN firstHeaderInfoBlock = strarr(3) readf, lun, firstHeaderInfoBlock ; Imports first 3 lines of file opticalDepthHeaderLine0 = firstHeaderInfoBlock[2] temp = strsplit(opticalDepthHeaderLine0, /EXTRACT) opticalDepths = float(temp[1:*]) nOpticalDepths = n_elements(opticalDepths) point_lun, lun, 0 ; Put file pointer at beginning of file again ; initialize the FDL Array fdlArray = fltarr(nOpticalDepths, nSZAs, nBands, nAerosolTypes) currentAerosolTypeLine = '' currentBandInfoLine = '' currentOpticalDepthInfoLine = '' currentSZALine='' for i = 0, nAerosolTypes-1 do begin readf, lun, currentAerosolTypeLine for j = 0, nBands-1 do begin readf, lun, currentBandInfoLine readf, lun, currentOpticalDepthInfoLine ; Now parse the FDL data from this latest aerosol/band block for k = 0, nSZAs-1 do begin readf, lun, currentSZALine temp = strsplit(currentSZALine, /EXTRACT) lineFDLValues = temp[1:*] fdlArray[0,k,j,i] = lineFDLValues endfor endfor endfor free_lun, lun return, fdlArray END
    You are not authorized to post a reply.