Skip to main content

Satellite, environmental and meteorologic information collect

Project description

Semic

Semic (Satellite Environmental and Meteorological Information Collect ) is a Python library for collecting weather, environmental data and satellite images from GPS coordinates.

Installation

If you want to collect Sentinel2 image data you will need to install :\

Use the package manager pip to install semic.

pip install semic

Usage

Import library and create an object.

from semic import DataRequest

obj = DataRequest('./', (200,200))
parameter description
path_to_folder (str) The path where you will save the data
size_img (tuple of int) The size of returned images

Set Sentinel2 parameters.

obj.set_sentinel_param(user, password, 1)
parameter description
user (str) Username of Sentinel account
pwd (str) Password of Sentinel account
width (int) Size in km of the zone (a square) you want to capture around the GPS coord
nb_of_tile (int, default = 1) The number max of tiles a sentinel query will return
path_to_sentinel (str, default = './') Path where Sentinel2 tiles will be downloaded
tile_name (str, default = None) Sentinel query with the specific name of a tile
dl_option (str, default = 'n') Can be 'y' or 'i'. If you find a tile that has not been already downloaded you can choose if you want to do it (y) or not (n) or his you want to interact and choose later (i)
cloudcover (tuple, default = (0,10)) Cloudcover percentage for Sentinel images

If you want to do the process without Sentinel2 data you just don’t set its parameters.

Search data from GPS coordinates and date

dic = obj.point((1.8, 43.2), 2019, 2)
parameter description
coords (tuple) GPS coordinates (longitude, latitude)
year (int) Year for the weather
month (int, default = None) Month for the weather
day (int, default = None) Day for the weather
outputs (list, default = all the possible outputs) outputs wanted

List of available outputs :

  • 'max_temp' : maximum temperature in °C (d)
  • 'min_temp' : minimum temperature in °C (d)
  • 'avg_temp' : average temperature in °C (m/y)
  • 'record_max_temp' : highest temperature in °C (m/y)
  • 'record_min_temp' : lowest temperature in °C (m/y)
  • 'wind_speed' : average wind speed in km/h (d/m/y)
  • 'humidity' : humidity in % (d/m/y)
  • 'visibility' : visibility in km (d/m/y)
  • 'cloud_coverage' : cloud coverage in % (d/m/y)
  • 'heat_index' : heat index (d/m/y)
  • 'dew_point_temp' : dew point in °C (d/m/y)
  • 'pressure' : pressure in hPa (d/m/y)
  • 'sunrise_time' : sunrise time in hour:minute:second (d/m/y)
  • 'sunset_time' : sunset time in hour:minute:second (d/m/y)
  • 'day_length' : day length in hour:minute:second (d/m/y)
  • 'rainfall' : total rainfall in mm (d/m/y)
  • 'avg_rainfall_per_day' : average rainfall per day in mm (m/y)
  • 'record_rainfall_day' : highest rainfall in mm (m/y)
  • 'img_plan' : PIL map image of the zone near the point (d/m/y)
  • 'img_sat' : PIL satellite image of the zone near the point (d/m/y)
  • 'elevation' : elevation of the point (d/m/y)
  • 'img_sentinel : PIL image of the zone taken in Sentinel2 data (d/m/y)
  • 'city' : Nearest city of the GPS point (d/m/y)

Save data

obj.to_json(dic, 'point')
parameter description
dic (dict) Dictionary containing the to be save
name (str) Name of the .json file created
sort (bool, default = True) Sort the keys in alphabetical order or not

The previous codes collect all the different data of February 2019 from a tuple (longitude, latitude) and store it in dic.
The function to_json will save the dictionary as a .json file into the folder indicated as parameter ('./') of the object DataRequest. Images of size (200,200) will be save in the same folder and only their path in the .json file.

Examples

from semic import DataRequest

obj = DataRequest('./', (200,200))
obj.set_sentinel_param(user, password, 1)

dic = obj.line([(1.88, 43.26), (1.85, 43.26)], 2019, 2, outputs=['max_temp', 'min_temp', 'avg_temp', 'record_max_temp', 'record_min_temp', 'wind_speed', 'humidity', 'img_sat'])
print(dic)

{'avg_temp': 10.0,
'record_max_temp': 23.0,
'record_min_temp': 9.0,
'max_temp': 14.0,
'min_temp': 5.0,
'wind_speed': 21.0,
'humidity': 76.0,
'img_sat': <PIL.Image.Image image mode=RGB size=200x200 at 0x20C0F7D55F8>}

dic['img_sat'].show()

img_sat

obj.to_json(dic, 'line')

This will collect the selected outputs data of February 2019 from a list of GPS coordinates and save it into a json file. The only different parameter from point to line function is ‘coords’ which need to be a list of coordinates in line

from semic import DataRequest

obj = DataRequest('./',(200,200))
obj.set_sentinel_param(user , password ,1)

dic = obj.polyline([[(1.88, 43.26), (1.85, 43.26)], [(1.86, 43.15), (1.86, 43.22)]], 2019, 2, 23)

obj.to_json(dic, 'polyline')

This will collect data of 23rd Feb. 2019 from a list of list of GPS coordinates. The parameters are once again the same except ‘coords’ which is now a list of list of coordinates.

License

Semic is open source and licensed under GNU General Public License v3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semic-0.0.5.tar.gz (471.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semic-0.0.5-py3-none-any.whl (485.9 kB view details)

Uploaded Python 3

File details

Details for the file semic-0.0.5.tar.gz.

File metadata

  • Download URL: semic-0.0.5.tar.gz
  • Upload date:
  • Size: 471.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for semic-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2d514a7cdb5fba5ec905ca883d3972fe9e48f3e18b296921e24ca6b0029b77f3
MD5 8395b9e39451ce4d30ab1541eb52de25
BLAKE2b-256 5eacdcd4ca230de7bf5def2f1f8291e4471a799c6cc708ac60269cd0e1f49bd7

See more details on using hashes here.

File details

Details for the file semic-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: semic-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 485.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.4.2 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for semic-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3536cc752ab1fc467f3084b46ddc4051e5b47debebc83fad0e287f2e9eacb8ba
MD5 d7bb8b17c9ce0da7c80ac4cdf7926d05
BLAKE2b-256 62b517b4a4b78265fe060beeb1fb674a140e7f001fd25c2476a83f5b0a55a5ec

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page