Skip to content

Instantly share code, notes, and snippets.

int nwd(int a,int b)
{
int c;
while(b != 0)
{
c = a % b;
a = b;
b = c;
}
return a;
import os
from shutil import copy
folder1 = 'C:\\bezwgledna\\sciezka\\do\\folderu1'
folder2 = 'C:\\bezwgledna\\sciezka\\do\\folderu2'
lista_poczatkow = ['poczatek1', 'poczatek2']
lista_plikow = os.listdir(folder1)
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
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])
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'])
@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

@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

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 / 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
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