This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (C) British Crown Copyright 2010 - 2013, Met Office | |
# | |
# This file is part of Iris. | |
# | |
# Iris is free software: you can redistribute it and/or modify it under | |
# the terms of the GNU Lesser General Public License as published by the | |
# Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# Iris is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netCDF4 | |
import numpy as np | |
def create_file(filename, format): | |
dataset = netCDF4.Dataset(filename, mode='w', format=format) | |
dataset.createDimension('time', None) | |
dataset.createDimension('space', 4) | |
dims = ('time', 'space') | |
little_little = dataset.createVariable('little-little', '<f4', dims) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from owslib.wmts import WebMapTileService | |
import cartopy.crs as ccrs | |
import matplotlib.pyplot as plt | |
if __name__ == '__main__': | |
url = 'http://map1c.vis.earthdata.nasa.gov/wmts-geo/wmts.cgi' | |
layer_name = 'MODIS_Terra_CorrectedReflectance_TrueColor' | |
extent = (28, 38, 25, 35) | |
axes_extent = (50, 53, 24, 27) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import time | |
import iris | |
def time_coord(cube): | |
"""Return the variable attached to time axis and rename it to time.""" | |
try: | |
cube.coord(axis='T').rename('time') |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################## | |
# | |
# Filter & modify | |
# | |
# ------------------------------ | |
# Callback | |
def callback(cube, field, filename) | |
if field.bar > 3: | |
raise iris.exceptions.IgnoreFieldException | |
field.foo = 9 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
sudo rm -r opt | |
sudo rm -r task | |
mkdir task | |
cp container-build.sh task/ | |
docker run -v /home/ec2-user/opt:/opt -v /home/ec2-user/task:/var/task -it lambci/lambda:build-python3.7 /bin/bash container-build.sh | |
pushd opt | |
zip -r9 ../iris-layer.zip * | |
popd |