diff --git a/tutorial/Add raster to interactive map.py b/tutorial/Add raster to interactive map.py new file mode 100644 index 0000000..cbd1028 --- /dev/null +++ b/tutorial/Add raster to interactive map.py @@ -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") diff --git a/tutorial/Create interctive map using folium.py b/tutorial/Create interctive map using folium.py new file mode 100644 index 0000000..d02b0c2 --- /dev/null +++ b/tutorial/Create interctive map using folium.py @@ -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") \ No newline at end of file diff --git a/tutorial/Download Landsat image and metadata using GeeOpener pylst.py b/tutorial/Download Landsat image and metadata using GeeOpener pylst.py new file mode 100644 index 0000000..68162a2 --- /dev/null +++ b/tutorial/Download Landsat image and metadata using GeeOpener pylst.py @@ -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) \ No newline at end of file diff --git a/tutorial/Download Landsat image collection and metadata using GeeOpener pylst.py b/tutorial/Download Landsat image collection and metadata using GeeOpener pylst.py new file mode 100644 index 0000000..174b535 --- /dev/null +++ b/tutorial/Download Landsat image collection and metadata using GeeOpener pylst.py @@ -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) diff --git a/tutorial/Example application of change detection.py b/tutorial/Example application of change detection.py new file mode 100644 index 0000000..f02efa6 --- /dev/null +++ b/tutorial/Example application of change detection.py @@ -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.") diff --git a/tutorial/Example application of zonal statistics.py b/tutorial/Example application of zonal statistics.py new file mode 100644 index 0000000..4b73308 --- /dev/null +++ b/tutorial/Example application of zonal statistics.py @@ -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) + diff --git a/tutorial/Example apply histogram.py b/tutorial/Example apply histogram.py new file mode 100644 index 0000000..0935975 --- /dev/null +++ b/tutorial/Example apply histogram.py @@ -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) \ No newline at end of file diff --git a/tutorial/Example of download Landsat image collection using landsat_downloader.py b/tutorial/Example of download Landsat image collection using landsat_downloader.py new file mode 100644 index 0000000..0e48dfb --- /dev/null +++ b/tutorial/Example of download Landsat image collection using landsat_downloader.py @@ -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)