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 pyspark.sql import SparkSession | |
spark = SparkSession\ | |
.builder\ | |
.appName("MyPySpark")\ | |
.getOrCreate() | |
sc = spark.sparkContext | |
my_file = sc.textFile("s3n://path/to/file") |
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 numpy as np | |
from math import pi, sqrt | |
def get_area(lat: float, d_lat: float, d_lng: float) -> float: | |
""" | |
Calculate geodesic area for lat/lng pixels using WGS 1984 as spatial reference. | |
Pixel area for a fix pixel width and hight various with latitude. | |
Pixels close to the equator have a larger areas. Area decreases towards the poles. | |
Arguments: |
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 arcpy | |
import urllib | |
import json | |
def harvest_feature_service(baseURL, whereClause="", fields="*", token="", messages=None): | |
""" | |
Return all records from a feature service as a feature set | |
:param baseURL: The base URL of the feature service, including the layer ID | |
:param whereClause: SQL where clause (optional) |
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 | |
import arcpy | |
arcpy.env.workspace = r"Database Servers\WRICWLT111900_SQLEXPRESS.gds\cmr_forest_atlas (VERSION:dbo.DEFAULT)" | |
desc = arcpy.Describe(arcpy.env.workspace) | |
print desc.workspaceType | |
subtypes = {"9100100": "Loi", |
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 requests | |
import json | |
def request_token(user, password): | |
d = {"username": user, | |
"password": password, | |
"referer":"http://www.arcgis.com", | |
"f": "json"} | |
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 arcpy | |
import numpy as np | |
import os | |
import gc | |
import sys | |
arcpy.env.overwriteOutput = True | |
def gf(scene, year, i): | |
input_folder = r'G:\UMD_Landsat_tiles\%i' % year |
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 os | |
import urllib | |
import csv | |
url = 'https://firms.modaps.eosdis.nasa.gov/active_fire/text/Global_24h.csv' | |
file_path = 'path_where_you_what_to_save_file' | |
urllib.urlretrieve(url, file_path) |
NewerOlder