Skip to content

Instantly share code, notes, and snippets.

function GetJulianDay # year, month, day
{
year=$1
month=$2
day=$3
jd=$((day - 32075 + 1461 * (year + 4800 - (14 - month) / 12) / 4 + 367 * (month - 2 + ((14 - month) / 12) * 12) / 12 - 3 * ((year + 4900 - (14 - month) / 12) / 100) / 4))
echo $jd
}
import obspy
from pathlib import Path
dataless_root = Path('directory_with_dataless')
positions = {}
for dataless_path in dataless_root.glob('*.DATALESS'):
# Reading dataless file
inv = obspy.read_inventory(str(dataless_path))
import obspy
# Reading a miniseed file
st = obspy.read('filepath.miniseed')
# Reading dataless file
inv = obspy.read_inventory('filepath.dataless')
# The easiest way to get station's position is to do that:
inv[0][0][0].longitude
@heavelock
heavelock / meta.yaml
Created April 2, 2019 10:00
conda-recipe for environs
{% set name = "environs" %}
{% set version = "4.1.0" %}
package:
name: "{{ name|lower }}"
version: "{{ version }}"
source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: a69695630145bf559baedd1ac99312abd27cca55cbc1dca7f7a6a2bae7e1570c
lsblk
sudo badblocks -wsv /dev/sdc
sudo parted /dev/sdc mktable msdos
sudo parted -a optimal /dev/sdc mkpart primary 0% 100%
sudo mkfs.vfat -F 32 /dev/sdc1
sudo mkfs -t ext3 /dev/sdc1
@heavelock
heavelock / datawell_viz.md
Created July 19, 2017 20:35 — forked from seumasmorrison/datawell_viz.md
Datawell processing scripts

As part of the HebMarine project a number of scripts were developed for processing the data recieved from the Datawell Waverider buoys and latterly the Nortek AWAC ADCPs.

Spectral polar plot

A number of approaches were taken with the various data outputs from the buoys. Visual representations of 3 minutely spectral data took place every half hour after the sync had taken place with the recieving station. This produced a polar contour plot for each buoy based on the direction, power spectral density, spread and skew. See Spectral Polar Plot repository and accompanying plot_spectra.py. The colorbar represents power spectral density (m2/Hz), the peak value on the plot can deviate from the max psd in the spectral file due to a hard to fit surface. ![example plot](https://b

@heavelock
heavelock / datawell_viz.md
Created July 19, 2017 20:34 — forked from seumasmorrison/datawell_viz.md
Datawell processing scripts

As part of the HebMarine project a number of scripts were developed for processing the data recieved from the Datawell Waverider buoys and latterly the Nortek AWAC ADCPs.

Spectral polar plot

A number of approaches were taken with the various data outputs from the buoys. Visual representations of 3 minutely spectral data took place every half hour after the sync had taken place with the recieving station. This produced a polar contour plot for each buoy based on the direction, power spectral density, spread and skew. See Spectral Polar Plot repository and accompanying plot_spectra.py. The colorbar represents power spectral density (m2/Hz), the peak value on the plot can deviate from the max psd in the spectral file due to a hard to fit surface. ![example plot](https://b

def plot_map(df, aax):
aax.clear()
aax.scatter(x = df.x,
y =df.y,
c = df['log_eng'],
s = df['log_eng'],
cmap = 'viridis_r',
alpha = 0.5)
aax.set_xlim(lim_rudna['xlim'])
aax.set_ylim(lim_rudna['ylim'])
import pandas as pd
df1 = pd.DataFrame([['adam','slodowy',1],['karol','karolowy',2],['igor','iksinski',3]])
df2 = pd.DataFrame([['adam','slodowy',13,'L'],['zdzisiek','jozek',13,'m'],['dupa','dupa',3,'k']])
df = pd.merge(a,b,how='left',on=[0,1])
lis3 = []
appended = False
for i in lis1:
for j in lis2:
if i[0] == j[0] and i[1] == j[1]:
lis3.append(j)
appended = True
break
if appended:
appended = False