Skip to content

Instantly share code, notes, and snippets.

@vincentsarago
Last active October 7, 2017 15:27
Show Gist options
  • Save vincentsarago/8cc9939f19043d38cb9ccfb0b0cb5beb to your computer and use it in GitHub Desktop.
Save vincentsarago/8cc9939f19043d38cb9ccfb0b0cb5beb to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1.0a9\n",
"[[ 1 2 3 4 5 6 7 8 9]\n",
" [ 2 4 -1 8 10 12 14 16 18]\n",
" [ 1 3 5 7 9 11 13 15 17]\n",
" [ 3 6 9 12 -1 18 21 24 27]\n",
" [ 5 10 15 20 25 30 35 40 -1]]\n",
"| 36.00, 0.00,-180.00|\n",
"| 0.00,-36.00, 90.00|\n",
"| 0.00, 0.00, 1.00|\n",
"-1.0\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/vincentsarago/Trav/Virtualenv/py3/lib/python3.6/site-packages/IPython/core/interactiveshell.py:2847: DeprecationWarning: 'src.affine' is deprecated. Please switch to 'src.transform'. See https://github.com/mapbox/rasterio/issues/86 for details.\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n"
]
}
],
"source": [
"import gzip\n",
"\n",
"import rasterio\n",
"print(rasterio.__version__)\n",
"\n",
"with gzip.open('sample_ascii_grid.txt.gz') as gzip_infile:\n",
" with rasterio.open(gzip_infile) as raster_infile:\n",
" raster = raster_infile.read(1)\n",
" affine = raster_infile.affine\n",
" nodata = raster_infile.nodata\n",
"\n",
"print(raster)\n",
"print(affine)\n",
"print(nodata)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.0"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment