-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Mon Jan 15 10:16:04 2024 | ||
@author: gardi | ||
""" | ||
|
||
#src = rasterio.open("C:/Users/gardi/NDVI.tif") | ||
|
||
|
||
from localtileserver import TileClient, get_leaflet_tile_layer | ||
from ipyleaflet import Map | ||
|
||
client = TileClient('C:/Users/gardi/NDVI.tif') | ||
|
||
layer = get_leaflet_tile_layer(client) | ||
|
||
m = Map(center=client.center(), zoom=client.default_zoom) | ||
m.add(layer) | ||
m | ||
|
||
# Save the interactive map as an HTML file (optional) | ||
m.save("interactive_map22.html") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Mon Jan 15 00:43:52 2024 | ||
@author: gardi | ||
""" | ||
|
||
import folium | ||
|
||
political_countries_url = ( | ||
"http://geojson.xyz/naturalearth-3.3.0/ne_50m_admin_0_countries.geojson" | ||
) | ||
|
||
m = folium.Map(location=(30, 10), zoom_start=3, tiles="cartodb positron") | ||
folium.GeoJson(political_countries_url).add_to(m) | ||
|
||
m.save("footprint.html") |
25 changes: 25 additions & 0 deletions
25
tutorial/Download Landsat image and metadata using GeeOpener pylst.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Fri Jan 12 18:56:51 2024 | ||
@author: gardi | ||
""" | ||
|
||
import ee | ||
# Authenticate using your GEE account credentials | ||
ee.Authenticate() | ||
|
||
ee.Initialize() | ||
|
||
from pylst.open.geeopener import GeeOpener | ||
|
||
# Create an instance of the GeeOpener class | ||
gee_opener = GeeOpener() | ||
|
||
# Specify region, start date, and end date | ||
region = ee.Geometry.Point(44.0092, 36.1911).buffer(10000) | ||
start_date = '2021-10-01' | ||
end_date = '2021-11-01' | ||
|
||
# Open the Landsat image from Google earth Engine and use landsat image ID as the filename with ".tif" | ||
gee_opener.open(region, start_date, end_date) |
30 changes: 30 additions & 0 deletions
30
tutorial/Download Landsat image collection and metadata using GeeOpener pylst.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Fri Jan 12 18:56:51 2024 | ||
@author: gardi | ||
""" | ||
|
||
import ee | ||
# Authenticate using your GEE account credentials | ||
ee.Authenticate() | ||
ee.Initialize() | ||
|
||
# from pylst.open.coopener import ColOpener | ||
import sys | ||
sys.path.append('D:\Python\pylst\pylst12\pylst\open') | ||
|
||
from coopener import ColOpener | ||
|
||
#from .coopener import ColOpener | ||
|
||
# Create an instance of the GeeOpener class | ||
gee_opener = ColOpener() | ||
|
||
# Specify region, start date, and end date | ||
region = ee.Geometry.Point(44.0092, 36.1911).buffer(100) | ||
start_date = '2020-07-01' | ||
end_date = '2020-08-01' | ||
|
||
# Open the Landsat image collection from Google Earth Engine | ||
gee_opener.open(region, start_date, end_date) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue Jan 16 21:15:34 2024 | ||
@author: Azad Rasul | ||
""" | ||
|
||
# Import the analyze_images function from the changedet module in the pylst.spatial_analysis package | ||
from pylst.spatial_analysis.changedet import analyze_images | ||
|
||
# Define paths to Landsat images for analysis | ||
landsat_image_path1 = "D:\\UHI_Baghdad\\LST_Baghdad\\LST23_07_2021_Landsat8_NRS.tif" | ||
landsat_image_path2 = "D:\\UHI_Baghdad\\LST_Baghdad\\LST14_07_2000_Landsat7_NRS.tif" | ||
|
||
# Define the output path for saving the analysis result as GeoTIFF | ||
output_path_geotiff = "D:\\UHI_Baghdad\\analysis_result_difference1.tif" | ||
|
||
# Call the analyze_images function | ||
analysis_result = analyze_images(landsat_image_path1, landsat_image_path2, output_path_geotiff) | ||
|
||
# Print the analysis result | ||
if analysis_result: | ||
# If analysis was successful, print the result and the path where the GeoTIFF result is saved | ||
print(analysis_result) | ||
print(f"Analysis result saved to: {output_path_geotiff}") | ||
else: | ||
# If analysis failed, print an error message | ||
print("Analysis failed.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Tue Jan 16 14:40:44 2024 | ||
@author: gardi | ||
""" | ||
# Import the calculate_zs function from the zonstat module in the pylst.spatial_analysis package | ||
from pylst.spatial_analysis.zonstat import calculate_zs | ||
|
||
# Define the path to the shapefile containing the administrative boundaries (in this case, Erbil_Admi_3.shp) | ||
shapefile_path = "C:\\Users\\gardi\\Erbil_Shapefile\\Erbil_Admi_3.shp" | ||
|
||
# Define the path to the raster file (in this case, Chirps_Erbil.tif) for spatial analysis | ||
raster_path = "C:\\Users\\gardi\\Chirps_Erbil.tif" | ||
|
||
# Call the calculate_zs function, passing the shapefile and raster paths as arguments | ||
# This function performs zone-based statistics, calculating values for each zone in the shapefile from the corresponding raster data | ||
df = calculate_zs(shapefile_path, raster_path) | ||
|
||
# Print the resulting DataFrame that contains the calculated zone-based statistics | ||
print(df) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Mon Jan 15 12:28:41 2024 | ||
@author: gardi | ||
""" | ||
from .visualization import histogram_equalization | ||
# Example application | ||
image_path = "C:/Users/gardi/NDVI.tif" # Replace with the path to your image | ||
histogram_equalization(image_path) |
21 changes: 21 additions & 0 deletions
21
tutorial/Example of download Landsat image collection using landsat_downloader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@author: Azad Rasul | ||
""" | ||
# pylst/open/example_usage.py | ||
|
||
# Import the download_images function from the landsat_downloader module | ||
from landsat_downloader import download_images | ||
|
||
# Specify the start and end dates for the Landsat image collection | ||
start_date = "2020-07-01" | ||
end_date = "2020-07-16" | ||
|
||
# Set the maximum allowed cloud cover percentage | ||
max_cloud_cover = 20 | ||
|
||
# Define the region of interest as a bounding box (longitude, latitude) | ||
region = [[-120, 34], [-120, 35], [-119, 35], [-119, 34], [-120, 34]] | ||
|
||
# Call the download_images function to download Landsat images | ||
download_images(start_date, end_date, max_cloud_cover, region) |