Skip to content

Commit

Permalink
Correcting modules paths
Browse files Browse the repository at this point in the history
  • Loading branch information
lunasilvestre committed Oct 19, 2023
1 parent 6502024 commit 97ad3c6
Show file tree
Hide file tree
Showing 22 changed files with 38 additions and 20 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/broadband_emiss.py → ee_lst/broadband_emiss.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ee
from modules.aster_bare_emiss import (
from ee_lst.aster_bare_emiss import (
emiss_bare_band10,
emiss_bare_band11,
emiss_bare_band12,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ee
from modules.aster_bare_emiss import emiss_bare_band13, emiss_bare_band14
from ee_lst.aster_bare_emiss import emiss_bare_band13, emiss_bare_band14


def add_emissivity_band(landsat, use_ndvi, image):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 25 additions & 7 deletions modules/landsat_lst.py → ee_lst/landsat_lst.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import ee
import os
from modules.ncep_tpw import add_tpw_band
from modules.cloudmask import mask_sr
from modules.compute_ndvi import add_ndvi_band
from modules.compute_fvc import add_fvc_band
from modules.compute_emissivity import add_emissivity_band
from modules.smw_algorithm import add_lst_band
from modules.constants import LANDSAT_BANDS
from ee_lst.ncep_tpw import add_tpw_band
from ee_lst.cloudmask import mask_sr
from ee_lst.compute_ndvi import add_ndvi_band
from ee_lst.compute_fvc import add_fvc_band
from ee_lst.compute_emissivity import add_emissivity_band
from ee_lst.smw_algorithm import add_lst_band
from ee_lst.constants import LANDSAT_BANDS

# Set the path to the service account key file
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "../.gee-sa-priv-key.json"
Expand All @@ -22,6 +22,21 @@ def initialize_ee():
ee.Initialize()


def add_timestamp(image):
timestamp = image.getNumber('system:time_start')
return image.addBands(ee.Image.constant(timestamp).rename('TIMESTAMP'))
# # Convert the system:time_start property to a human-readable string
# timestamp_string = ee.Date(image.get("system:time_start")).format(
# "YYYY-MM-DD HH:mm:ss"
# )
# # Set the timestamp string as a new property on the image
# return image.set("timestamp", timestamp_string)


def add_raw_timestamp(image):
return image.set("raw_timestamp", image.get("system:time_start"))


def fetch_landsat_collection(landsat, date_start, date_end, geometry, use_ndvi):
"""
Fetches a Landsat collection based on the provided parameters
Expand Down Expand Up @@ -76,4 +91,7 @@ def fetch_landsat_collection(landsat, date_start, date_end, geometry, use_ndvi):
# Compute the LST
landsat_lst = landsat_all.map(lambda image: add_lst_band(landsat, image))

# Add timestamp to each image in the collection
landsat_lst = landsat_lst.map(add_timestamp) #.map(add_raw_timestamp)

return landsat_lst
File renamed without changes.
2 changes: 1 addition & 1 deletion modules/smw_algorithm.py → ee_lst/smw_algorithm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import ee
from modules.constants import SMW_COEFFICIENTS, LANDSAT_BANDS
from ee_lst.constants import SMW_COEFFICIENTS, LANDSAT_BANDS


def get_lookup_table(coeff, prop_1, prop_2):
Expand Down
Empty file added examples/__init__.py
Empty file.
2 changes: 1 addition & 1 deletion tests/test_aster_bare_emiss.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import aster_bare_emiss
from ee_lst import aster_bare_emiss

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image, expected_output_emissivity
Expand Down
2 changes: 1 addition & 1 deletion tests/test_broadband_emiss.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import broadband_emiss
from ee_lst import broadband_emiss

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image, expected_output_bbe
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cloudmask.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import cloudmask
from ee_lst import cloudmask

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image_sr, load_test_image_toa,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_compute_emissivity.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import compute_emissivity
from ee_lst import compute_emissivity

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image, expected_output_em
Expand Down
2 changes: 1 addition & 1 deletion tests/test_compute_fvc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import compute_fvc
from ee_lst import compute_fvc

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image, expected_output_fvc
Expand Down
2 changes: 1 addition & 1 deletion tests/test_compute_ndvi.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import compute_ndvi
from ee_lst import compute_ndvi

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image, expected_output_ndvi
Expand Down
2 changes: 1 addition & 1 deletion tests/test_landsat_lst.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import landsat_lst
from ee_lst import landsat_lst

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ncep_tpw.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import ncep_tpw
from ee_lst import ncep_tpw

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image
Expand Down
2 changes: 1 addition & 1 deletion tests/test_smw_algorithm.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# import pytest
from modules import smw_algorithm
from ee_lst import smw_algorithm

# Mock data imports (you can replace these with actual data loading methods)
# from data.input_data import load_test_image, expected_output_lst
Expand Down
2 changes: 1 addition & 1 deletion validation/example_1_service_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import time
from google.oauth2 import service_account
from googleapiclient.discovery import build
from modules.landsat_lst import fetch_landsat_collection
from ee_lst.landsat_lst import fetch_landsat_collection
import io
from googleapiclient.http import MediaIoBaseDownload

Expand Down

0 comments on commit 97ad3c6

Please sign in to comment.