Skip to content

Instantly share code, notes, and snippets.

#########################
# NumPy Raster Calculator
# -----------------------
# Purpose: The purpose of this Python script is to use ArcGIS's arcpy package along with the Python library numpy to convert Landsat thermal bands from digital numbers to Top of Atmosphere (ToA) brightness-temperature values that provide pixel temperature in degrees Celsius.
# Purpose #2: The second purpose is that it allows some work to be done on rasters without the need for the Spatial Analyst extension
#
# Requirements: ESRI ArcGIS arcpy; Python 2.7.x; numpy; Landsat data
# ArcPy takes care of the dirty work of conversions and geospatial stuff and I have ArcGIS installed, hence it's use.
#########################
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@simrit1
simrit1 / modern-geospatial-python.md
Created June 28, 2022 18:03 — forked from rukku/modern-geospatial-python.md
Modern remote sensing image processing with Python
[package]
name = "snake_game"
version = "0.1.0"
authors = ["youcodethings <spyr1014@gmail.com>"]
[dependencies]
piston = "0.36.0"
piston2d-graphics = "0.26.0"
pistoncore-glutin_window = "0.45.0"
piston2d-opengl_graphics = "0.52.0"
@simrit1
simrit1 / complex.py
Created June 22, 2022 07:11 — forked from bellbind/complex.py
[python3] Calc Riemann Zeta function
# complex arith for programming with other languages
# - required functions: exp(f), log(f), sin(f), cos(f), atan2(f), pow(f1, f2)
import math
# [equality for complex]
def ceq(a, b):
return a.real == b.real and a.imag == b.imag
# [add, sub, mul for complex]
import asyncio
from tortoise import Tortoise, run_async, connections
from tortoise.models import Model
from tortoise import fields
import random
import time
class Employees(Model):
ID = fields.IntField(pk=True)
NAME = fields.TextField()
AGE = fields.IntField()
@simrit1
simrit1 / crawl_valence_arousal_dataset.py
Created April 10, 2022 18:17 — forked from MaxHilsdorf/crawl_valence_arousal_dataset.py
This code crawls a dataset, which can be used for mood-based recommendations, from the Spotify API
#################
## PREPARATION ##
#################
# Import modules
import sys
# If your authentification script is not in the project directory
# append its folder to sys.path
sys.path.append("../spotify_api_web_app")
import authorization
while (True):
vp.rate(500)
#Calculte the force using gravitationalForce function
star.force = gravitationalForce(star,planet1)+gravitationalForce(star,planet2)+gravitationalForce(star,planet3)
planet1.force = gravitationalForce(planet1,star)+gravitationalForce(planet1,planet2)+gravitationalForce(planet1,planet3)
planet2.force = gravitationalForce(planet2,star)+gravitationalForce(planet2,planet1)+gravitationalForce(planet2,planet3)
planet3.force = gravitationalForce(planet3,star)+gravitationalForce(planet3,planet1)+gravitationalForce(planet3,planet2)
#Update momentum, position and time
#Travel times between each crop for each direction
right = [0.42666667, 0.55466667, 0.56533333, 0.576, 0.576, 0.448, 0.59733333, 0.576, 0.56533333, 0.46933333, 0.58666667]
left = [0.71466667, 0.55466667, 0.69333333, 0.59733333, 0.69333333, 0.576, 0.71466667, 0.58666667, 0.576, 0.69333333, 0.576]
up = [0.58666667, 0.45866667, 0.59733333, 0.58666667, 0.576, 0.58666667, 0.46933333, 0.576, 0.55466667]
down = [0.59733333, 0.576, 0.58666667, 0.59733333, 0.45866667, 0.576, 0.56533333, 0.576, 0.448]
#Set arbitrary starting vertex and initialise w(s, s) as 0 and direction as empty in Q
s = 30
Q = np.array([[s, None, 0]])
import numpy as np
def crossEntropy(Y, P):
Y = np.float_(Y)
P = np.float_(P)
CE = -np.sum(Y*np.log(P) + (1-Y)*np.log(1-P))
return CE