{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Example - Rasterizing Point Data" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import json\n", "from functools import partial\n", "\n", "import geopandas\n", "from shapely.geometry import box, mapping\n", "\n", "from geocube.api.core import make_geocube\n", "from geocube.rasterize import rasterize_points_griddata, rasterize_points_radial\n", "\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load in geopackage data and add CRS" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "gdf = geopandas.read_file(\n", " \"../../test/test_data/input/time_vector_data.geojson\",\n", " crs=\"epsg:4326\"\n", ")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | test_attr | \n", "test_str_attr | \n", "test_time_attr | \n", "geometry | \n", "
---|---|---|---|---|
0 | \n", "1.3 | \n", "dcf86619 | \n", "5/21/2016 10:09:21 AM -05:00 | \n", "POINT (-47.26681 44.21932) | \n", "
1 | \n", "1.3 | \n", "dcf86619 | \n", "5/21/2016 10:09:21 AM -05:00 | \n", "POINT (-47.26680 44.21932) | \n", "
2 | \n", "1.9 | \n", "dcf86619 | \n", "5/21/2016 10:09:21 AM -05:00 | \n", "POINT (-47.26681 44.21932) | \n", "
3 | \n", "1.3 | \n", "dcf86619 | \n", "5/21/2016 10:09:21 AM -05:00 | \n", "POINT (-47.26680 44.21932) | \n", "
4 | \n", "1.3 | \n", "dcf86619 | \n", "5/21/2016 10:09:21 AM -05:00 | \n", "POINT (-47.26679 44.21932) | \n", "
<xarray.Dataset>\n", "Dimensions: (x: 12, y: 11)\n", "Coordinates:\n", " * y (y) float64 45.25 45.15 45.05 44.95 ... 44.55 44.45 44.35 44.25\n", " * x (x) float64 -47.27 -47.27 -47.27 ... -47.27 -47.27 -47.27\n", " spatial_ref int64 0\n", "Data variables:\n", " test_attr (y, x) float64 1.3 1.3 1.3 1.2 1.3 1.3 ... 2.3 1.3 1.9 1.3 1.3\n", "Attributes:\n", " grid_mapping: spatial_ref" ], "text/plain": [ "