Skip to content

Instantly share code, notes, and snippets.

@brwe
brwe / all_the_orbits.py
Created May 31, 2021 22:05
get all orbits between two dates
import requests
from pathlib import Path
from datetime import date, timedelta
from requests.auth import HTTPBasicAuth
import xml.etree.ElementTree as ET
import os
def save_all_orbits(date_str, platformnumber, producttype, result_path, session):
base_url = f"https://scihub.copernicus.eu/gnss/search?q=platformname:Sentinel-1 AND platformnumber:{platformnumber} AND producttype:{producttype} AND beginposition:[{date_str}T00:00:000Z TO {date_str}T24:00:000Z]"
<graph id="Graph">
<version>1.0</version>
<node id="Read">
<operator>Read</operator>
<sources/>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<file>PATH_TO_INPUT/S1A_IW_GRDH_1SDV_20210608T175808_20210608T175833_038252_04839C_339D/manifest.safe</file>
</parameters>
</node>
<node id="Apply-Orbit-File">
snap --modules --list --refresh --nogui --nosplash
/usr/local/snap/bin/../platform/lib/nbexec: WARNING: environment variable DISPLAY is not set
Refreshing SNAP Supported Plugins
Refreshing SNAP Core
Refreshing SNAP Toolboxes
Code Name Version State
-------------------------------------------------- -------- ----------------
org.csa.rstb.rstb.op.polarimetric.tools 8.0.3 Enabled
org.esa.s2tbx.s2tbx.s2msi.reader 8.0.1 Upgrade to 8.0.2
org.esa.snap.snap.temporal.percentile 8.0.3 Enabled
--2021-05-20 11:13:34-- https://download.esa.int/step/snap/8.0/installers/esa-snap_all_unix_8_0.sh
Resolving download.esa.int (download.esa.int)... 157.185.179.197
Connecting to download.esa.int (download.esa.int)|157.185.179.197|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 981541327 (936M) [application/octet-stream]
Saving to: ‘esa-snap_all_unix_8_0.sh.2’
esa-snap_all_unix_8_0.sh.2 100%[===============================================================================================================>] 936.07M 1.09MB/s in 15m 58s
2021-05-20 11:29:33 (1001 KB/s) - ‘esa-snap_all_unix_8_0.sh.2’ saved [981541327/981541327]
<graph id="Graph">
<version>1.0</version>
<!-- usage example:
/usr/local/snap/bin/gpt all-steps.xml -Pinput=PATH_TO_MANIFEST_FILE/manifest.safe -Pvh_result_file_name=PATH_TO_RESULT_FILE/vh.tif -Pvv_result_file_name=PATH_TO_RESULT_FILE/vv.tif
-->
<node id="Read">
<operator>Read</operator>
<sources/>
<parameters class="com.bc.ceres.binding.dom.XppDomElement">
<file>${input}</file>
@brwe
brwe / example-queries
Last active September 23, 2017 04:17
Significant terms examples, meetup "elasticsearch switzerland", June 5 2014
# Terms aggregations
POST reuters/_search
# aggregate on places - how many articles per country?
POST reuters-test/_search
{
"size": 0,
"aggregations": {
"class": {
DELETE testtags
POST testtags
{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
}
@brwe
brwe / meetupExamples.json
Created October 29, 2013 10:43
scoring oddities
#init data
DELETE testtags/
POST testtags/
{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
Thread [TEST-DecayFunctionScoreTests.testBoostModeSettingWorks-seed#[566D4516876EE0AF]] (Suspended (breakpoint at line 34 in ElasticSearchParseException))
owns: Class<T> (org.elasticsearch.common.inject.InjectorImpl) (id=3217)
owns: TestCluster (id=3748)
ElasticSearchParseException.<init>(String, Throwable) line: 34
ByteSizeValue.parseBytesSizeValue(String, ByteSizeValue) line: 164
ByteSizeValue.parseBytesSizeValue(String) line: 137
DiskThresholdDecider.thresholdBytesFromWatermark(String) line: 319
DiskThresholdDecider.<init>(Settings, NodeSettingsService) line: 128
NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method]
NativeConstructorAccessorImpl.newInstance(Object[]) line: 57
@brwe
brwe / gist:7056487
Created October 19, 2013 14:18
function score example that checks for words in a multi valued field and adds 1 if the word was found.
curl -XPOST "http://localhost:9200/scorescripttest/test/" -d'
{
"tags": [
"dressing room",
"zebrawood",
"wood",
"oak",
"on your person",
"seating",
"chair",