View myscript2.py
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
# -*- coding: utf-8 -*- | |
""" | |
*************************************************************************** | |
* * | |
* This program is free software; you can redistribute it and/or modify * | |
* it under the terms of the GNU General Public License as published by * | |
* the Free Software Foundation; either version 2 of the License, or * | |
* (at your option) any later version. * | |
* * |
View qgis_network_analysis.py
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
project = QgsProject.instance() | |
start_points = project.mapLayersByName('start_points')[0] # start | |
end_points = project.mapLayersByName('end_points')[0] # end | |
network = project.mapLayersByName('network')[0] # network | |
## from polyline to director | |
director = QgsVectorLayerDirector( | |
source=network, |
View layer_to_df.py
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
# -*- coding: utf-8 -*- | |
""" | |
/*************************************************************************** | |
DataPlotlyDialog | |
A QGIS plugin | |
D3 Plots for QGIS | |
------------------- | |
begin : 2020-08-17 | |
git sha : $Format:%H$ | |
copyright : (C) 2017 by matteo ghetta |
View gee_qgis.py
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 ee | |
from ee_plugin import Map | |
# Sentinel data | |
collection = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_NO2') | |
# Band of NO2 | |
collection = collection.select('tropospheric_NO2_column_number_density') | |
# 2019 data | |
collection2019 = collection.filterDate('2019-03-01', '2019-04-30') |
View pandas_melt.py
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
# -*- coding: utf-8 -*- | |
""" | |
*************************************************************************** | |
* * | |
* This program is free software; you can redistribute it and/or modify * | |
* it under the terms of the GNU General Public License as published by * | |
* the Free Software Foundation; either version 2 of the License, or * | |
* (at your option) any later version. * | |
* * |
View covid-pandas.py
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 plotly.express as px | |
df = pd.read_csv("https://gist.github.com/ghtmtt/66164cc25a7b160cef99fa61b2feca59/raw/3034facfdecf7358934d9f0a78341c4d13f2af47/covid-pandas.csv") | |
col = [col for col in df.columns if '20' in col] | |
dfm = pd.melt( | |
df, | |
id_vars=["Province/State", "Country/Region", "continent", "Lat", "Long"], | |
value_vars=col, |
View covid-pandas.csv
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 2.
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
Province/State,Country/Region,Lat,Long,1/22/20,1/23/20,1/24/20,1/25/20,1/26/20,1/27/20,1/28/20,1/29/20,1/30/20,1/31/20,2/1/20,2/2/20,2/3/20,2/4/20,2/5/20,2/6/20,2/7/20,2/8/20,2/9/20,2/10/20,2/11/20,2/12/20,2/13/20,2/14/20,2/15/20,2/16/20,2/17/20,2/18/20,2/19/20,2/20/20,2/21/20,2/22/20,2/23/20,2/24/20,2/25/20,2/26/20,2/27/20,2/28/20,2/29/20,3/1/20,3/2/20,3/3/20,3/4/20,3/5/20,3/6/20,3/7/20,3/8/20,3/9/20,3/10/20,3/11/20,3/12/20,3/13/20,3/14/20,3/15/20,3/16/20,3/17/20,3/18/20,3/19/20,3/20/20,3/21/20,3/22/20,3/23/20,3/24/20,3/25/20,3/26/20,3/27/20,3/28/20,3/29/20,3/30/20,3/31/20,4/1/20,4/2/20,4/3/20,4/4/20,4/5/20,4/6/20,4/7/20,4/8/20,4/9/20,4/10/20,4/11/20,4/12/20,4/13/20,continent | |
,Afghanistan,33,65,"0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","0","1","1","1","1","1","1","1","1","1","1","1","1","1","4","4","5","7","7","7","11","16","21","22","22","22","24","24","40","40","74","84","94","110","110","120","170","174","237","273","281 |
View test_output.txt
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
---------------------------------------- | |
Compiled translation files to .qm files. | |
---------------------------------------- | |
Processing: DataPlotly/i18n/DataPlotly_en.ts | |
Updating 'DataPlotly/i18n/DataPlotly_en.qm'... | |
Generated 0 translation(s) (0 finished and 0 unfinished) | |
Ignored 164 untranslated source text(s) | |
Processing: DataPlotly/i18n/DataPlotly_it.ts | |
Updating 'DataPlotly/i18n/DataPlotly_it.qm'... |
View geocoding.py
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
# the function needs geopy | |
# for Windows users, to install geopy, open the OSGEO4W Shell and type: | |
# py3_env | |
# pip3 install geopy | |
from qgis.core import * | |
from qgis.gui import * | |
from geopy.geocoders import Nominatim | |
locator = Nominatim(user_agent="myGeocoder") |
View variable_apprach.py
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 plotly import graph_objs as go | |
a = [go.Scatter({ | |
#'customdata': [so4], | |
'hoverinfo': 'all', | |
'ids': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | |
21, 22, 23, 24, 25, 26, 27, 28, 29, 30], | |
'line': {'dash': 'solid', 'width': 1.0}, | |
'marker': {'color': [203, 151, 350, 137, 319, 329, 267, 88, 98, 84, 100, 627, 306, 513, 267, | |
457, 683, 791, 788, 265, 296, 680, 536, 1122, 632, 1055, 1322, 1485, |
NewerOlder