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
<style> | |
/* change background colours around elements */ | |
.mapboxgl-ctrl.mapboxgl-ctrl-attrib { | |
background-color: rgba(86, 1, 1, 0.7); | |
} | |
.mapboxgl-ctrl.mapboxgl-ctrl-attrib a { | |
color: #d17d61 !important; | |
} | |
/* change background colours around elements */ | |
.mapboxgl-ctrl-group { |
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
--- | |
title: "R Notebook" | |
output: html_notebook | |
--- | |
```{r} | |
# create list of countries who qualified and their placement in the wc | |
qualified <- c('Spain','Nigeria','Egypt','Costa Rica','Japan','Tunisia', 'France','Switzerland','Portugal', 'Russia','Colombia','Peru','Senegal','United Kingdom','Denmark','Brazil','Germany','Iran (Islamic Republic of)','Korea, Republic of','Morocco', 'Belgium','Croatia','Saudi Arabia','Uruguay','Iceland','Argentina','Panama','Poland','Australia','Mexico','Sweden','Serbia') | |
# knocked out of group stage |
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
var beforeMap = new mapboxgl.Map({ | |
container: 'before', | |
style: 'mapbox://styles/tastatham1/cjjy2a3sd4lx02sqcse1jkgyd', | |
center: [0, 43.825234], | |
pitch:20, | |
zoom: 4 | |
}); | |
var afterMap = new mapboxgl.Map({ |
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
# Load pkgs and data | |
import geopandas as gpd | |
data = gpd.read_file("https://gist.githubusercontent.com/HTenkanen/456ec4611a943955823a65729c9cf2aa/raw/be56f5e1e5c06c33cd51e89f823a7d770d8769b5/ykr_basegrid.geojson") | |
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres')) | |
# Subset argentina as single ply | |
argentina = world[world['name'] == 'Argentina' ] | |
# Define engine | |
engine = create_engine("postgresql+psycopg2://[user]:[password]@localhost:5432/[my_db]") |
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 modules | |
from dask_geomodeling.raster import RasterBlock | |
from dask_geomodeling.raster import base | |
from dask_geomodeling.geometry import base | |
# Define paths | |
arg_rast_path = 'raster.tif' | |
arg_vec_path = 'vector.shp' | |
""" |
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 dask | |
import dask_geomodeling | |
request = { | |
"mode": "vals", | |
"bbox": (138000, 480000, 139000, 481000), | |
"projection": "epsg:28992", | |
"width": 256, | |
"height": 256 | |
} | |
graph, name = add.get_compute_graph(**request) |
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
def compute_zonal_stats(raster, vector, fid, col, statistics,tile,mode): | |
""" | |
Calculate zonal statistics using dask | |
Parameters | |
---------- | |
raster : A GeoDataFrame to create multiple copies based on the list of density thresholds |
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 pandas as pd | |
import geopandas as gpd | |
def multi_ring_buffers(gdf, number, distance): | |
""" | |
Apply a function to a GeoDataFrame containing Point data and compute constant multi-ring buffers | |
Parameters | |
---------- |
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 pandas | |
import geopandas | |
import rioxarray | |
from shapely.geometry import box | |
def _polygonize(rioxarray_obj): | |
"""""" | |
poly_ls = [] |
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
def spatial_shuffle(ddf, by="hilbert", column=None, npartitions=20, p=10, **kwargs): | |
""" | |
A function that spatially shuffles a Dask-GeoSeries object by a method | |
or a user-defined column | |
Parameters | |
---------- | |
by : str | |
partitioning method or column |
OlderNewer