-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Please #5
Comments
Unfortunately these scripts are not maintained any more. They would need to be updated before they could run. You're very welcome to contribute to the repo. |
I have edited the parts related to Landsat version. However, I am getting an error in the part related to Band 6. I would be very happy if you could help me. I would like to share the latest edited version with you. |
Are you working on the js code or the python code? Can you share the code in ur repo so i can look at it to help? |
// This script processes a single Landsat 8 image of interest. // Author: Benjamin Page // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Import Collections // // landsat 8 raw dn // landsat-8 surface reflactance product (for masking purposes) // toms / omi /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var pi = ee.Image(3.141592); // water mask // filter landsat 8 collection print(l8, 'l8 image info') // oli image date var footprint = l8.geometry() /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // dem // ozone //Julian Day // Earth-Sun distance //Sun elevation //Sun azimuth //Satellite zenith //Satellite azimuth //Sun zenith //Relative azimuth //Pressure calculation // Radiometric Calibration // // radiance_mult_bands // radiance add band //create an empty image to save new radiance bands to // esun var ESUNImg_OLI = ESUN_OLI.arrayProject([0]).arrayFlatten([bands_OLI]); // Ozone Correction // // Calculate ozone optical thickness // Calculate TOA radiance in the absense of ozone // Rayleigh optical thickness // create an empty image to save new Tr values to // Fresnel Reflection // var theta_j_OLI = sin_theta_j_OLI.asin().multiply(ee.Image(180).divide(pi)); var theta_SZ_OLI = SunZe_OLI; var R_theta_SZ_s_OLI = (((theta_SZ_OLI.multiply(pi.divide(ee.Image(180)))).subtract(theta_j_OLI.multiply(pi.divide(ee.Image(180))))).sin().pow(2)).divide((((theta_SZ_OLI.multiply(pi.divide(ee.Image(180)))).add(theta_j_OLI.multiply(pi.divide(ee.Image(180))))).sin().pow(2))); var R_theta_V_s_OLI = ee.Image(0.0000000001); var R_theta_SZ_p_OLI = (((theta_SZ_OLI.multiply(pi.divide(180))).subtract(theta_j_OLI.multiply(pi.divide(180)))).tan().pow(2)).divide((((theta_SZ_OLI.multiply(pi.divide(180))).add(theta_j_OLI.multiply(pi.divide(180)))).tan().pow(2))); var R_theta_V_p_OLI = ee.Image(0.0000000001); var R_theta_SZ_OLI = ee.Image(0.5).multiply(R_theta_SZ_s_OLI.add(R_theta_SZ_p_OLI)); var R_theta_V_OLI = ee.Image(0.5).multiply(R_theta_V_s_OLI.add(R_theta_V_p_OLI)); // Rayleigh scattering phase function // var theta_neg_inv_OLI = theta_neg_OLI.acos().multiply(ee.Image(180).divide(pi)); var theta_pos_OLI = (cosdSunZe_OLI.multiply(cosdSatZe_OLI)).subtract(sindSunZe_OLI.multiply(sindSatZe_OLI).multiply(cosdRelAz_OLI)); var theta_pos_inv_OLI = theta_pos_OLI.acos().multiply(ee.Image(180).divide(pi)); var cosd_tni_OLI = theta_neg_inv_OLI.multiply(pi.divide(180)).cos(); // in degrees var cosd_tpi_OLI = theta_pos_inv_OLI.multiply(pi.divide(180)).cos(); // in degrees var Pr_neg_OLI = ee.Image(0.75).multiply((ee.Image(1).add(cosd_tni_OLI.pow(2)))); var Pr_pos_OLI = ee.Image(0.75).multiply((ee.Image(1).add(cosd_tpi_OLI.pow(2)))); // Rayleigh scattering phase function // Calulate Lr, // Rayleigh corrected radiance // Rayleigh corrected reflectance // Aerosol Correction // // Lam in SWIR bands // Calculate aerosol type // Calculate multiple scattering of aerosols for each band // diffuse transmittance // Compute water-leaving radiance // water-leaving reflectance // Rrs /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Surface water temperature var b10_add_band = ee.Number(TIRS_1.get('RADIANCE_ADD_BAND_10')); var Oi = ee.Number(0.29); var TIRS_cal = (TIRS_1.multiply(b10_mult_band).add(b10_add_band).subtract(Oi)); //.multiply(lakes); var K1_b10 = ee.Number(TIRS_1.get('K1_CONSTANT_BAND_10')); var LST = ((ee.Image(K2_b10).divide(((ee.Image(K1_b10).divide(ee.Image(TIRS_cal))).add(ee.Image(1))).log())).subtract(ee.Image(273))).multiply(mask); // Celsius // chlor_a var log_BG = (Rrs.select('B1').divide(Rrs.select('B3'))).log10(); var a1a = a1.multiply(log_BG.pow(1)); var sum = a1a.add(a2a).add(a3a).add(a4a); var log10_chlor_a = a0.add(sum); var chlor_a = ee.Image(10).pow(log10_chlor_a); // SD // tsi // Reclassify TSI // Create conditions // Reclassify conditions into new values // Ouput of reclassified image // Map Layers // EXPORT IMAGES // // Export LST // Export chlor_a // Export SD // Export TSI // Export TSI_R |
am a PhD student in the department of surveying engineering in Turkey. I am grateful for your help. I have just started working on software. I am working on my PhD thesis. I would like to thank you for your work. Thank you very much for your interest and concern. |
JS CODE |
I'll start with the code u shared and go from there. The error message image must be different code, since the line giving that error is not in the code u shared. Give me a few minutes to see if i can quickly work out the error i'm seeing and get it running. |
// This script processes a single Landsat 8 image of interest. // Author: Benjamin Page // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Import Collections // // landsat 8 raw dn // landsat-8 surface reflactance product (for masking purposes) // toms / omi /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var pi = ee.Image(3.141592); // water mask // filter landsat 8 collection print(l8, 'l8 image info') // oli image date var footprint = l8.geometry() /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // dem // ozone //Julian Day // Earth-Sun distance //Sun elevation //Sun azimuth //Satellite zenith //Satellite azimuth //Sun zenith //Relative azimuth //Pressure calculation // Radiometric Calibration // // radiance_mult_bands // radiance add band //create an empty image to save new radiance bands to // esun var ESUNImg_OLI = ESUN_OLI.arrayProject([0]).arrayFlatten([bands_OLI]); // Ozone Correction // // Calculate ozone optical thickness // Calculate TOA radiance in the absense of ozone // Rayleigh optical thickness // create an empty image to save new Tr values to // Fresnel Reflection // var theta_j_OLI = sin_theta_j_OLI.asin().multiply(ee.Image(180).divide(pi)); var theta_SZ_OLI = SunZe_OLI; var R_theta_SZ_s_OLI = (((theta_SZ_OLI.multiply(pi.divide(ee.Image(180)))).subtract(theta_j_OLI.multiply(pi.divide(ee.Image(180))))).sin().pow(2)).divide((((theta_SZ_OLI.multiply(pi.divide(ee.Image(180)))).add(theta_j_OLI.multiply(pi.divide(ee.Image(180))))).sin().pow(2))); var R_theta_V_s_OLI = ee.Image(0.0000000001); var R_theta_SZ_p_OLI = (((theta_SZ_OLI.multiply(pi.divide(180))).subtract(theta_j_OLI.multiply(pi.divide(180)))).tan().pow(2)).divide((((theta_SZ_OLI.multiply(pi.divide(180))).add(theta_j_OLI.multiply(pi.divide(180)))).tan().pow(2))); var R_theta_V_p_OLI = ee.Image(0.0000000001); var R_theta_SZ_OLI = ee.Image(0.5).multiply(R_theta_SZ_s_OLI.add(R_theta_SZ_p_OLI)); var R_theta_V_OLI = ee.Image(0.5).multiply(R_theta_V_s_OLI.add(R_theta_V_p_OLI)); // Rayleigh scattering phase function // var theta_neg_inv_OLI = theta_neg_OLI.acos().multiply(ee.Image(180).divide(pi)); var theta_pos_OLI = (cosdSunZe_OLI.multiply(cosdSatZe_OLI)).subtract(sindSunZe_OLI.multiply(sindSatZe_OLI).multiply(cosdRelAz_OLI)); var theta_pos_inv_OLI = theta_pos_OLI.acos().multiply(ee.Image(180).divide(pi)); var cosd_tni_OLI = theta_neg_inv_OLI.multiply(pi.divide(180)).cos(); // in degrees var cosd_tpi_OLI = theta_pos_inv_OLI.multiply(pi.divide(180)).cos(); // in degrees var Pr_neg_OLI = ee.Image(0.75).multiply((ee.Image(1).add(cosd_tni_OLI.pow(2)))); var Pr_pos_OLI = ee.Image(0.75).multiply((ee.Image(1).add(cosd_tpi_OLI.pow(2)))); // Rayleigh scattering phase function // Calulate Lr, // Rayleigh corrected radiance // Rayleigh corrected reflectance // Aerosol Correction // // Lam in SWIR bands // Calculate aerosol type // Calculate multiple scattering of aerosols for each band // diffuse transmittance // Compute water-leaving radiance // water-leaving reflectance // Rrs /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Surface water temperature var b10_add_band = ee.Number(TIRS_1.get('RADIANCE_ADD_BAND_10')); var Oi = ee.Number(0.29); var TIRS_cal = (TIRS_1.multiply(b10_mult_band).add(b10_add_band).subtract(Oi)); //.multiply(lakes); var K1_b10 = ee.Number(TIRS_1.get('K1_CONSTANT_BAND_10')); var LST = ((ee.Image(K2_b10).divide(((ee.Image(K1_b10).divide(ee.Image(TIRS_cal))).add(ee.Image(1))).log())).subtract(ee.Image(273))).multiply(mask); // Celsius // chlor_a var log_BG = (Rrs.select('B1').divide(Rrs.select('B3'))).log10(); var a1a = a1.multiply(log_BG.pow(1)); var sum = a1a.add(a2a).add(a3a).add(a4a); var log10_chlor_a = a0.add(sum); var chlor_a = ee.Image(10).pow(log10_chlor_a); // SD // tsi // Reclassify TSI // Create conditions // Reclassify conditions into new values // Ouput of reclassified image // Map Layers // EXPORT IMAGES // // Export LST // Export chlor_a // Export SD // Export TSI // Export TSI_R |
YOU CAN USE THE LAST CODE I SENT. THANK YOU VERY MUCH |
almost there, give me a few more minutes, i am down to two errors, which i am debugging |
Here is the code that gets you past the original errors. The only issue left is that it needs to have the date ranges for the operations.
|
I AM GRATEFUL TO YOU. THANK YOU VERY MUCH. FOR YOUR SUPPORT OF SCIENTIFIC STUDY. YOU MADE ME VERY HAPPY. |
Hello, I wish you good work. Can you update the codes related to water quality?
The text was updated successfully, but these errors were encountered: