Skip to content

Instantly share code, notes, and snippets.

View aolinto's full-sized avatar

Antonio Olinto Avila da Silva aolinto

View GitHub Profile
import copernicusmarine as cm
cm.subset(
dataset_id="cmems_mod_glo_phy_my_0.083deg_P1M-m",
#dataset_id="cmems_mod_glo_phy_myint_0.083deg_P1M-m",
dataset_version="202311",
variables=["bottomT", "mlotst", "so", "thetao"],
minimum_longitude=-49.0,
maximum_longitude=-38.5,
minimum_latitude=-28.5,
@aolinto
aolinto / multiobs_glo_phy_nc_to_csv.R
Created June 11, 2024 22:43
script to process Copernicus Multi Observation Global Ocean 3D Temperature Salinity
# =======================================================================================================================
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# version 2024/06/04
# https://gist.github.com/aolinto/3828be642d06857788500d51f114eb49
# script to process Multi Observation Global Ocean 3D Temperature Salinity Height Geostrophic Current and MLD
# product MULTIOBS_GLO_PHY_TSUV_3D_MYNRT_015_012
# https://doi.org/10.48670/moi-00052
# nc file downloaded from
# https://data.marine.copernicus.eu/product/MULTIOBS_GLO_PHY_TSUV_3D_MYNRT_015_012/services
# dataset-armor-3d-rep-monthly
@aolinto
aolinto / copernicus_multiobs_glo_phy.py
Last active June 11, 2024 23:04
download copernicus armor-3d-rep-monthly dataset
import copernicusmarine as cm
cm.subset(
dataset_id="dataset-armor-3d-rep-monthly",
dataset_version="202012",
variables=["mlotst","so","to"],
minimum_longitude=-49.0,
maximum_longitude=-38.5,
minimum_latitude=-28.5,
maximum_latitude=-17.5,
@aolinto
aolinto / polygons_color_pattern.R
Last active November 21, 2021 16:03
polygons with colors and patterns
# ====================================
# Polygons with colors and patterns
# Author: Antônio Olinto Ávila da Silva
# Created: 2021-11-21
# Last edition:
# ====================================
# in Linux to install the packages one may need
sudo apt install libmagick++-dev
sudo apt install libudunits2-dev
@aolinto
aolinto / popdin.R
Last active October 15, 2021 13:21
Example of estimates for population dynamics
# ====================================
# Population Dynamics Example
# Author: Antônio Olinto Ávila da Silva
# Created: 2021-09-13
# Last edition: 2021-10-15
# ====================================
# libraries
# =========
library(ggplot2)
@aolinto
aolinto / multiobs_to_so.R
Last active June 4, 2021 21:52
Copernicus Multi Observation Global Ocean 3D Temperature Salinity
# =======================================================================================================================
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# version 2021/04/19
# https://gist.github.com/aolinto/86d2091a5337c1bbcec888e37ca884b3
# script to process Multi Observation Global Ocean 3D Temperature Salinity
# product MULTIOBS_GLO_PHY_TSUV_3D_MYNRT_015_012
# nc file downloaded from
# https://resources.marine.copernicus.eu/?option=com_csw&view=details&product_id=MULTIOBS_GLO_PHY_TSUV_3D_MYNRT_015_012
# dataset-armor-3d-rep-monthly
# the script will transform nc file to brick raster, read temperature and salinity data
@aolinto
aolinto / TRMM_precipitation.R
Last active November 21, 2022 23:16
script to process Tropical Rainfall Measuring Mission (TRMM) data
# ==========================================================================================
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# version 2021/04/19
# https://gist.github.com/aolinto/3a0872e0fb61b7ca3e69d35d286ae26c
# script to process Tropical Rainfall Measuring Mission (TRMM) data
# 3B43.7: Monthly 0.25 x 0.25 degree merged TRMM and other sources estimates
# files downloaded from
# https://disc.gsfc.nasa.gov/
# select: TRMM_3b43_7 / Subset-Get data /
# Download: OPeNDAP / variables: precipitation / file format: netCDF
@aolinto
aolinto / COPERNICUS_Multiobs_3d.R
Created August 3, 2019 19:12
R script to extract COPERNICUS Temperature and Salinity statistics from a nc file based on a polygon
# Antonio Olinto Avila-da-Silva, Instituto de Pesca, Brasil
# https://gist.github.com/aolinto/9d9514eb453109425f5b35c42fa0eb95
# 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-armor-3d-rep-monthly
# the script will transform nc file to brick raster, read temperature and salinity data
# for a given area and depth, compute its statistics and write them into
# a single csv file named COPERNICUS_to.csv or COPERNICUS_so.csv
@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