Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit 3c62803

Browse files
committed
readme for the normal people
1 parent 9fa6dd9 commit 3c62803

File tree

6 files changed

+131
-31
lines changed

6 files changed

+131
-31
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.dccache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/setup.py":[187,1665945270843.9788,"7b5e3dae2181865ee2e6677b5da29c2cb2936b613421fc0da9d4ddb0c259e2f0"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/test_environment.py":[632,1665769793462.981,"ee78fe56893706ef9f77ddcb205ca6eeff927ae073e9db3093f42b2cc4ef90de"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/__init__.py":[137,1665940595968.2097,"87d9c09cd5e2f39504c7bdb64a0f81aba30077b6a9a01511123f3cae6349da5d"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/__init__.py":[108,1665766228448.3696,"98fd2716236b138e03696cff737c7ed2df5739510f2520c47c2f36fd7eeb2fad"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/_masking.py":[1199,1665765966401.5696,"37eda0d3653b806e54cc78b2f497658d46b8a24bcde015fec780658a8242030b"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/_utilities.py":[1508,1665929784273.8462,"5c630a012fe96056a76344144ec2878cac5b2c8d962b7e25a1406a5f9f0608bb"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/query_data.py":[2125,1665929800531.341,"80687d2b80e355e63057f6a716853c847752f4167759eed46f0035320b05193f"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/sentinel_metadata.py":[4568,1665929821931.7932,"41b4838aaf963861f10c0eb2df771bd4222a916ed5d3158a76f6c337ebe42416"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/__init__.py":[94,1665766478549.3625,"83a31ef58e58a372f414927dd0e1731183dc5181b074bc16bed979d5f9347c15"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/_utilities_dwl.py":[2002,1665940628732.902,"85cacbe0be92d738ee5f7f770762abb95d6d3f5ec24d824e16aac63197037f92"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/download_s1grd.py":[54007,1665929747899.772,"065b7d496919656ee4a46dc41453da14fc89add7da462cc7fe62d0ba0ae81972"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/satellite_download.py":[990,1665929757692.162,"e71cb2002bdd5a4f8d30ea214396e66ddc40492bea45f8e46225336cb4f4efca"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/Process.py":[16026,1665929878906.5054,"8940eba7a6afee68b0b012564ee279a9ceeceebc6da7652aa3d57a7b67568693"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/__init__.py":[320,1665930100261.08,"ce2f5dfc79443f9886e41fc77507d43e4d0a5038deaeee0041aa88812cb12098"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/_get_functions.py":[2952,1665929851418.5913,"d0874e54aa9c1df6c56bed3ba81a586c77a7c9d76b316b9bd6d67727b0d8b503"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/_load_image.py":[9427,1665929874951.7104,"52e0ab1a686c3ccd3637d626c3602a9bcea5318452532591b555b7f2a5a4c58f"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/_proces_tools.py":[1605,1665929871282.0786,"422e19afa111689212f6e3e62fb56d4e1cf8f473cb354440364b1ea594bef21d"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/filters.py":[915,1665929866842.5588,"20fef664433bbff4accb4df92244e0a067bec57b8595fb2abfe154c6f6f642ad"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/load_data.py":[16504,1665767203974.8152,"34af39b784a60db1075e43267c5228b2a40b81bcdc037b99f312517050828e1e"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/visualize/__init__.py":[19,1665766242758.0427,"4d7d5f913f097bc1e683c5e103abc0b5294e3e5b7c09508c559070202f935f2b"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/visualize/show.py":[4032,1665929895801.5596,"fac25c5539ffe39f7c13fce746c60c86eca2f70f4fffde52b60a34c15a3c5cfc"]}
1+
{"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/test_environment.py":[632,1665769793462.981,"ee78fe56893706ef9f77ddcb205ca6eeff927ae073e9db3093f42b2cc4ef90de"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/__init__.py":[137,1665940595968.2097,"87d9c09cd5e2f39504c7bdb64a0f81aba30077b6a9a01511123f3cae6349da5d"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/__init__.py":[94,1665766478549.3625,"83a31ef58e58a372f414927dd0e1731183dc5181b074bc16bed979d5f9347c15"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/_utilities_dwl.py":[2002,1665940628732.902,"85cacbe0be92d738ee5f7f770762abb95d6d3f5ec24d824e16aac63197037f92"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/download_s1grd.py":[54007,1665929747899.772,"065b7d496919656ee4a46dc41453da14fc89add7da462cc7fe62d0ba0ae81972"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/download/satellite_download.py":[990,1665929757692.162,"e71cb2002bdd5a4f8d30ea214396e66ddc40492bea45f8e46225336cb4f4efca"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/__init__.py":[108,1665766228448.3696,"98fd2716236b138e03696cff737c7ed2df5739510f2520c47c2f36fd7eeb2fad"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/_masking.py":[1199,1665765966401.5696,"37eda0d3653b806e54cc78b2f497658d46b8a24bcde015fec780658a8242030b"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/_utilities.py":[1508,1665929784273.8462,"5c630a012fe96056a76344144ec2878cac5b2c8d962b7e25a1406a5f9f0608bb"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/query_data.py":[2125,1665929800531.341,"80687d2b80e355e63057f6a716853c847752f4167759eed46f0035320b05193f"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/metadata/sentinel_metadata.py":[4568,1665929821931.7932,"41b4838aaf963861f10c0eb2df771bd4222a916ed5d3158a76f6c337ebe42416"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/Process.py":[16026,1665929878906.5054,"8940eba7a6afee68b0b012564ee279a9ceeceebc6da7652aa3d57a7b67568693"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/__init__.py":[320,1665930100261.08,"ce2f5dfc79443f9886e41fc77507d43e4d0a5038deaeee0041aa88812cb12098"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/_get_functions.py":[2952,1665929851418.5913,"d0874e54aa9c1df6c56bed3ba81a586c77a7c9d76b316b9bd6d67727b0d8b503"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/_load_image.py":[9427,1665929874951.7104,"52e0ab1a686c3ccd3637d626c3602a9bcea5318452532591b555b7f2a5a4c58f"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/_proces_tools.py":[1605,1665929871282.0786,"422e19afa111689212f6e3e62fb56d4e1cf8f473cb354440364b1ea594bef21d"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/filters.py":[915,1665929866842.5588,"20fef664433bbff4accb4df92244e0a067bec57b8595fb2abfe154c6f6f642ad"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/pre_process_grd/load_data.py":[16504,1665767203974.8152,"34af39b784a60db1075e43267c5228b2a40b81bcdc037b99f312517050828e1e"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/visualize/__init__.py":[19,1665766242758.0427,"4d7d5f913f097bc1e683c5e103abc0b5294e3e5b7c09508c559070202f935f2b"],"/Users/kaaso/Documents/phd/coding/Sentinel_1_python/src/sentinel_1_python/visualize/show.py":[4032,1665929895801.5596,"fac25c5539ffe39f7c13fce746c60c86eca2f70f4fffde52b60a34c15a3c5cfc"]}

README.md

Lines changed: 129 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,153 @@
11

22
<img src="figs/s1.gif" width="750" align="center">
33

4-
[![DOI](https://zenodo.org/badge/259046250.svg)](https://zenodo.org/badge/latestdoi/259046250)
54
[![Coverage Status](https://coveralls.io/repos/github/aalling93/Sentinel_1_python/badge.svg)](https://coveralls.io/github/aalling93/Sentinel_1_python)
65
![Repo Size](https://img.shields.io/github/repo-size/aalling93/Sentinel_1_python)
76
[![Known Vulnerabilities](https://snyk.io/test/github/aalling93/Sentinel_1_python//badge.svg)](https://snyk.io/test/github/aalling93/Sentinel_1_python/)
87
![Python](https://img.shields.io/badge/python-3.9-blue.svg)
98

109

10+
Kristian Aalling Sørensen
11+
12+
13+
14+
# Brief Description
15+
<a class="anchor" id="intro"></a>
1116

12-
## Introduction <a class="anchor" id="intro"></a>
1317

1418
This is a Python module for working with Sentinel-1 satellite images, purly in Python. It allows you to find the images you want, download them and work with them (calibrate, speckle fitler etc.).. I use the SentinelSAT package for the metadata. The data is then downloaded from NASA ASF.
1519

1620

1721

1822

1923

20-
## Content <a class="anchor" id="content"></a>
21-
* [Download Sentinel-1 images with Python](#dwl)
2224

25+
26+
# Table Of Contents
27+
<a class="anchor" id="content"></a>
28+
29+
- [Introduction](#Introduction)
30+
- [Requirements](#Requirements)
31+
- [Install and Run](#Install-and-Run)
2332
* [Use Sentinel-1 images in Python](#use)
24-
* [Load Sentinel-1 GRD](#grd)
33+
* [SAR, briefly](#sar)
34+
- [Acknowledgments](#Acknowledgments)
2535

26-
* [Decode Sentinel-1 level-0](#decode)
27-
* [Calibrate Sentinel-1 GRD](#calibrate)
2836

2937

30-
* [SAR, briefly](#sar)
38+
# Requirements
39+
<a class="anchor" id="Requirements"></a>
3140

41+
- [numpy](https://github.com/numpy)
42+
- [geopandas](https://github.com/geopandas)
43+
- [gdal](https://github.com/geopandas)
44+
- [mgrs](https://github.com/mgrs) (should be removed in later version.. sry..)
45+
- [scikit-learn](https://github.com/scikit-learn) (should be removed in later version.. sry..)
46+
- [scipy](https://github.com/scipy) (should be removed in later version.. sry..)
47+
- [cartopy](https://github.com/cartopy)
48+
- [rasterio](https://github.com/rasterio)
49+
- [Pillow](https://github.com/Pillow)
50+
- [pandas](https://github.com/pandas)
51+
- [sentinelsat](https://github.com/sentinelsat)
52+
- [matplotlib](https://github.com/matplotlib)
3253

33-
## Download Sentinel-1 images with Python <a class="anchor" id="dwl"></a>
34-
The sentinel_download module can be used to find the images you need and subsequently to download them.
35-
```python
36-
#decide area, time, and level
37-
# filter the data, e.g., only iw, vv, etc etc.
38-
met.iw()
39-
# Check the images before downloading
40-
met.show_cross_pol()
41-
```
42-
<img src="figs/slc_thumn.png" width="750" align="center">
4354

55+
# Install and Run
56+
<a class="anchor" id="Install-and-Run"></a>
57+
58+
This repo can be installed using either git clone OR pypi.. Currently, I have only placed in pypi-test, so lets hope it stays there..
59+
60+
61+
**Using Pypi**
62+
63+
1. GDAL. Make sure your gdal bindings are working...
64+
65+
2. Install sentinel_1_python using pypy test
66+
```
67+
python3 -m pip install sentinel-1-python --extra-index-url=https://test.pypi.org/simple/
68+
```
69+
70+
71+
**Using clone**
72+
73+
1. Install all requirments
74+
75+
2. Clone
76+
```
77+
git clone https://github.com/aalling93/sentinel_1_python.git
78+
79+
```
4480

45-
We can now download the images we want, for instance the third and fourth
46-
```python
47-
with Satellite_download(met.products_df[2:3]) as dwl:
4881

49-
```
5082

51-
And voila. You have now downloaded the images.
5283

5384

5485
## Use Sentinel-1 images in Python <a class="anchor" id="use"></a>
5586
Go back to [Table of Content](#content)
5687

88+
1. Get metadata of images
89+
------------
5790

58-
### Load Sentinel-1 level-0 in python<a class="anchor" id="level0"></a>
91+
```python
92+
with Sentinel_metadata() as met:
93+
met.area([29.9,21,56.7,58])
94+
met.get_metadata(sensor='s1_slc',start_data='20220109',end_date='20221010')
95+
```
96+
97+
2. Filter the images if you want
98+
----------------
99+
```python
100+
met.iw() #filer so we only have IW
101+
```
102+
103+
104+
3. Displaying the images before download:
105+
```python
106+
met.plot_image_areas() # Showing extent of images
107+
met.show_cross_pol(4)
108+
```
109+
We can then see then extent of the images.
110+
111+
<img src="figs/extent.png" width="450" align="center">
112+
113+
And display the images before downloading them...
114+
<img src="figs/slc_thumn.png" width="450" align="center">
115+
116+
4. Download the images
117+
--------------
118+
```python
119+
folder = f'{os.getenv("raw_data_dir")}/slc_sweden'
120+
with Satellite_download(met.products_df) as dwl:
121+
os.makedirs(folder, exist_ok=True)
122+
#save metadata
123+
dwl.products_df.to_pickle(f'{folder}/slc_dataframe.pkl')
124+
#download the thumbnails
125+
dwl.download_thumbnails(folder=f'{folder}/slc_thumbnails')
126+
#download the slc images in .zip format and extract to .SAFE format..
127+
dwl.download_sentinel_1(f'{folder}/slc')
128+
```
59129

60-
### Load Sentinel-1 SLC <a class="anchor" id="slc"></a>
61130

62-
### Sentinel-1 GRD <a class="anchor" id="grd"></a>
131+
5. Load, calibrate, speckle filter image in python
63132

64-
### Sentinel-1 calibrate <a class="anchor" id="calibrate"></a>
133+
```python
134+
image_paths = glob.glob(f'{os.getenv("raw_data_dir")}/*/*/*.SAFE')
135+
img = s1_load(image_paths[0])
136+
img =img.calibrate(mode='gamma') # could also use, e.g., 'sigma_0'
137+
img = img.boxcar(5) #could easily make, e.g., a Lee filter..
138+
img.simple_plot(band_index=0)
139+
```
140+
141+
we can now exctract a region of the image, defined by either index or coordinate set.
142+
```python
143+
indx = img.get_index(lat=57.0047,long=19.399)
144+
img[indx[0]-125:indx[0]+125,indx[1]-125:indx[1]+125].simple_plot(band_index=1)
145+
```
65146

66-
### Decode Sentinel-1 level-0 <a class="anchor" id="decode"></a>
67147

148+
------------
68149

150+
<img src="figs/calibrate.png" width="450" align="center">
69151

70152
## SAR satellites <a class="anchor" id="sar"></a>
71153
Go back to [Table of Content](#content)
@@ -111,4 +193,22 @@ Double bounce scattering and occurs when the transmitted pulse is reflected spec
111193

112194
Due to the geometry of the SAR and its moving platform, typical SAR imaging sensors are designed to take focused images with good resolution under the assumption that their target is stationary during image acquisition. This focusing can not be made on moving targets, and normal SAR instruments are therefore ill suited to detect fast moving objects, such as ships. The results is a well resolved static background and poorly resolved moving target. In non-cooperative surveillance tasks, this is a significant problem. Under the assumption that a target is moving perpendicular to the line of sight of the SAR with a constant acceleration, it is possible to reduce the problem by taking the doppler shift of the SAR images into consideration. Maritime vessels do not normally follow such patterns. Hence, more complex trajectory patterns must be accounted for when looking at ships with SAR instruments.
113195

114-
In summary, using the capabilities of a SAR instrument, it should be possible to detect ships on the ocean surface.
196+
In summary, using the capabilities of a SAR instrument, it should be possible to detect ships on the ocean surface.
197+
198+
199+
200+
201+
# Acknowledgments
202+
<a class="anchor" id="Acknowledgments"></a>
203+
Myself,
204+
Simon Lupemba,
205+
Eigil Lippert
206+
207+
# Licence
208+
See License file. In short:
209+
210+
1. Cite me in your work! something like: Kristian Aalling Sørensen, 2022, [email protected]
211+
2. Get as many as possible to follow me on Github. You and your colleagues who use this at the very least. I am a like-hunter.
212+
3. Star this repository, conditioned to the same as above.
213+
4. Maybe write me an email or two, telling me how amazing job I did?
214+
5. Help me with improving the work. I am always looking for collaborators.

examples/examples_pypi_build/download_calibrate_speckle.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"outputs": [],
130130
"source": [
131131
"folder = f'{os.getenv(\"raw_data_dir\")}/test_folder'\n",
132-
"with Satellite_download(met.products_df[0:2]) as dwl:\n",
132+
"with Satellite_download(met.products_df) as dwl:\n",
133133
" os.makedirs(folder, exist_ok=True)\n",
134134
" #save metadata\n",
135135
" dwl.products_df.to_pickle(f'{folder}/grd_dataframe.pkl')\n",

figs/calibrate.png

287 KB
Loading

figs/extent.png

874 KB
Loading

0 commit comments

Comments
 (0)