Skip to content

Instantly share code, notes, and snippets.

@etoyoda
etoyoda / rng2sch.xsl
Created July 20, 2022 17:55
XSLT stylesheet to extract Schematron 1.5 embedded in RELAX NG
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://www.ascc.net/xml/schematron"
xmlns:rng="http://relaxng.org/ns/structure/1.0"
>
<xsl:output method="xml" indent="yes" standalone="yes"/>
<xsl:template match="/rng:grammar">
<s:schema>
@etoyoda
etoyoda / tetens_inv.rb
Created May 29, 2021 12:12
inverse function of Tetens formula
def tetens t
6.112 * Math.exp(17.67 * (t - 273.15) / (t - 29.65))
end
def invtetens e
k = Math.log(e/6.112) / 17.67
0.05 * (-5463.0 + 593.0 * k) / (-1.0 + k)
end
(0..50).each {|tc|
@etoyoda
etoyoda / upper-plot-model.html
Created January 15, 2020 10:30
高層地点プロットに矢羽根・気温・露点温度を詰め込む例
<html>
<head>
<style type="text/css">
.stn { width: 64px; height: 64px;
position: absolute; top: 150px; left: 100px;
border: 1px solid cyan; box-sizing: border-box; }
.wb { width: 64px; height: 64px; position: absolute; top: 0; left: 0; }
.ne { font-size: 10px; line-height: 10px;
text-shadow: 1px 1px 0 #FFF;
position: absolute; top: 20px; left: 32px; text-align: left; }
@etoyoda
etoyoda / statstn_21-26N119-123E.txt
Created December 7, 2019 14:16
2019-12-06 の BABJ 発 BUFR SYNOP の地点リストを抽出し、さきの vola_21-26N119-123E.txt の地点を強調したもの
038,ISIN21BABJ 50468,50953,51076,51243,51288,51463,51573,51709,52533,52652,52866,52983,53463,53513,53588,53772,53915,54218,54337,54342,54401,54471,54497,54511,54823,56080,56096,57083
038,ISIN22BABJ 56187,56778,57265,57461,57494,57516,57687,57816,58040,58102,58150,58221,58238,58251,58362,58457,58606,58752,58847,59117,59134,59287,59316,59431,59644,59758
038,ISIN23BABJ 50136,50745,50774,50788,51133,51431,51747,52203,52418,52681,53564,53614,53646,53798,53845,53959,54094,54102,54161,54292,54374,54423,54618,54843,54909,56029,57127,57131
038,ISIN24BABJ 56146,56444,56492,56571,57799,57866,57957,57993,58027,58141,58265,58472,58477,58527,58633,58666,58725,58921,59082,59211,59265,59293,59501,59663,59838,59948,59981
038,ISIN25BABJ 50353,50557,50756,50949,50963,50978,51087,51156,51644,51656,51886,52602,52713,52754,52818,52836,52955,53068,53276,54135,54236,54539,54662,54753,54857,57067,57178,57245,57297
038,ISIN26BABJ 55299,55591,56739,56951,56964,57328,57411,57447,57662,57745,57972,58203,58314,58424,59023,59417,59985
038,
@etoyoda
etoyoda / vola_21-26N119-123E.txt
Created December 7, 2019 14:10
WMO vola_legacy_report.txt から、21-26N 119-123E (除25N以北120E以西)を抽出したもの
58965 TAOYUAN 25 03 00N 121 13 00E
58968 TAIBEI 25 02 00N 121 31 00E
58974 PENGJIA YU 25 38 00N 122 04 00E
59152 XINZHU 24 48 00N 120 58 00E
59158 TAIZHONG 24 09 00N 120 41 00E
59162 YILAN 24 46 00N 121 45 00E
59345 MAGONG 23 31 00N 119 34 00E
59348 DONGJI 23 16 00N 119 40 00E
59353 ALI SHAN 23 31 00N 120 48 00E
59358 TAINAN 23 00 00N 120 13 00E
@etoyoda
etoyoda / atomdif.rb
Created October 6, 2019 00:47
make a diff of two files containing Atom Feed made for JMA XML (not all Atom Feed tags handled)
#!/usr/bin/ruby
require 'rexml/parsers/baseparser'
require 'rexml/parsers/streamparser'
require 'rexml/streamlistener'
class AtomParse
include REXML::StreamListener
def initialize
@etoyoda
etoyoda / regtest.c
Created August 18, 2018 16:40
C code to test regex(3)'s behaviour especially about match data for parenthized pattern
#include <stdio.h>
#include <sys/types.h>
#include <regex.h>
#define NMATCH 10
int
main(int argc, char **argv)
{
regex_t reg;
@etoyoda
etoyoda / syndl.rb
Last active April 7, 2018 19:22
ruby script to download realtime wx data from WIS GISC Tokyo website, using GDBM
#!/usr/bin/ruby
require 'net/http'
require 'openssl'
require 'uri'
require 'gdbm'
require 'syslog'
class WGet
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>作図例</title>
<!--
Leaflet のプログラム読み込み。integrityはCDNでの改ざんを防ぐための情報セキュリティ対策
@etoyoda
etoyoda / newnames.txt
Last active August 29, 2015 14:27
new standard names for flood simulation, sent to CF-Metadata mailing list
1) flood_water_thickness
The flood_water_thickness is the vertical distance
between the surface of the flood water and the surface of ground,
as measured at a given point in space.
The flood_water is water that covers land
which is normally not covered by water.
Canonical Units: m