Skip to content

Instantly share code, notes, and snippets.

View Tendro's full-sized avatar

Tendro Ramaharitra Tendro

View GitHub Profile
@aolinto
aolinto / MODISA_sst_grid.R
Last active February 12, 2021 22:03
R script to extract Aqua MODIS SST statistics from a nc file based on a multi-feature shapefile
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# https://gist.github.com/aolinto/2099bbf7af343e2b9f919f5317c508b9
# script to process Aqua MODIS Sea Surface Temperature
# files downloaded from https://oceancolor.gsfc.nasa.gov/cgi/l3
# Aqua MODIS Sea Surface temperature 11 µ daytime Monthly 4 km SMI images or
# Aqua MODIS Sea Surface temperature 11 µ nigthtime Monthly 4 km SMI images
# all .L3m_MO_SST_sst_4km.nc (daytime) or .L3m_MO_NST4_sst4_4km (nigthtime)
# files must be in the working directory
# the script will open each nc file to read date information
# the script will also transform nc file to raster, read sst data
@aolinto
aolinto / COPERNICUS_sss_pol.R
Last active August 11, 2020 03:17
R script to extract COPERNICUS sea surface salinity data from a polygon
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# https://gist.github.com/aolinto/59e43cdbac3ff3e0cd5eb2eab5efcbc4
# script to process COPERNICUS Sea Surface Salinity
# product MULTIOBS_GLO_PHY_REP_015_002
# nc file downloaded from
# http://marine.copernicus.eu/services-portfolio/access-to-products/?option=com_csw&view=details&product_id=MULTIOBS_GLO_PHY_REP_015_002
# dataset-sss-ssd-rep-monthly sos variable
# the script will transform nc file to stack raster, read sss data
# for a given area, compute its statistics and write them into
# a single csv file named COPERNICUS_sss.csv
@aolinto
aolinto / MODIS download
Last active August 11, 2020 02:29
Download SST and Chlor Modis Aqua images
# https://oceancolor.gsfc.nasa.gov/forum/oceancolor/topic_show.pl?tid=3081
# https://oceancolor.gsfc.nasa.gov/cgi/l3
# Aqua MODIS Chlorophyll-a OCI Monthly 4 km
wget -q --post-data="sensor=aqua&sdate=2002-01-01&edate=2018-07-31&dtype=L3m&addurl=1&results_as_file=1&search=A*L3m_MO_CHL_chlor_a_4km.nc" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search |wget -i -
# Aqua MODIS Sea surface temperature 11 µ nighttime Monthly 4 km
wget -q --post-data="sensor=aqua&sdate=2008-01-01&edate=2018-07-31&dtype=L3m&addurl=1&results_as_file=1&search=A*L3m_MO_NSST_sst_4km.nc" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search |wget -i -
# Aqua MODIS Sea surface temperature 11 µ daytime Monthly 4 km
@aolinto
aolinto / fishing_area.R
Created August 24, 2018 13:25
Selects fishing area squares per trip and calculates their centroids
# ====================================================================
# Selects fishing area squares per trip and calculates their centroids
# author: Antônio Olinto Ávila da Silva
# creation: 2018-08-24
# last edition: 2018-08-24
# ====================================================================
# prepare workspace
library(rgdal)
library(rgeos)
@aolinto
aolinto / MODISA_chl_pol.R
Last active August 11, 2020 03:21
R script to extract Aqua MODIS Chlorophyll statistics from a nc file based on a polygon
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# https://gist.github.com/aolinto/b1414f94a0891d9e5d580d0436db8495
# script to process Aqua MODIS Clorophyll Concentration data
# files downloaded from https://oceancolor.gsfc.nasa.gov/cgi/l3
# Aqua MODIS Clorophyll Concentration, OCI Algorithm Monthly 4 km SMI images
# all .L3m_MO_CHL_chlor_a_4km.nc files must be in the working directory
# the script will open each nc file to read date information
# the script will also transform nc file to raster, read chl data
# for a given area, compute its statistics and write them into
# a single csv file named MODISA_chl.csv
@aolinto
aolinto / MODISA_sst.R
Last active January 4, 2023 16:57
R script to extract Aqua MODIS Sea Surface Temperature data from a nc file
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# ver 2016-05-17
# https://gist.github.com/aolinto/79e184f6c156c6ab21b3
# script to process Aqua MODIS Sea Surface Temperature
# files downloaded from http://oceancolor.gsfc.nasa.gov/cgi/l3
# Aqua MODIS Sea Surface temperature 11 u daytime Monthly 9 km SMI images
# all .L3m_MO_SST_sst_9km.nc files must be in the working directory
# the script will open each nc file, read date, lon, lat and sst data,
# then select data from specified area and write them into
# a single csv file named MODISA_sst.csv
@erans
erans / get_lat_lon_exif_pil.py
Created May 20, 2011 21:16
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)