Skip to content

Instantly share code, notes, and snippets.

@mehori
mehori / 00get.jra3q.currect.sh
Created March 18, 2026 05:51
RDA d640001 から JRA-3Q の最新データをダウンロードするスクリプト
#!/bin/bash
function get_file(){
local yr=$1
local mon=$2
local day1=$3
local day2=$4
local vtype=$5
local var=$6
@mehori
mehori / 00get.jra3q.sh
Created March 18, 2026 05:45
RDA d640000 から JRA-3Q を wget でダウンロードするスクリプト
#!/bin/bash
function get_file(){
local yr=$1
local mon=$2
local day1=$3
local day2=$4
## analysis / variable type
local vtype=$5
@mehori
mehori / update_frontmatter.py
Last active January 2, 2025 02:00
csv ファイルで与えた「パス、カテゴリ、タグ(複数)」で frontmatter を書き換えて出力する python スクリプト
import csv
import frontmatter
import shutil
import sys
def update_frontmatter(csv_file):
with open(csv_file, 'r') as file:
reader = csv.reader(file)
for row in reader:
try:
@mehori
mehori / attention-international-users.md
Last active September 20, 2024 13:11
VRChatのワールドに「日本の初心者ユーザー向け」と表示したい場合の英語例

VRChatのワールドに「日本の初心者ユーザー向け」と表示したい場合に "Attention" 「注目 / 注意」という表題のもとにこうしたメッセージを出しておくと効果があるかもしれません。

Attention

This world is intended for beginner users in Japan to learn VRChat and make friends talking in Japanese. To all international users, we kindly ask you to give space to such users and refrain from talking in English or any other language besides Japanese so that they can get used to VRChat in the comfort of their language. Your understanding is greatly appreciated.

翻訳(Translation):

このワールドは日本の初心者ユーザーが日本語でVRChatについて学び、友達を見つけるために作られています。その他の国のみなさんは、英語など日本語以外の言葉で話しかけないようにして、そうした初心者ユーザーが母国語で安心して慣れることができるようにしてあげてください。ご協力に感謝します。

{
"editor.tokenColorCustomizations": {
"textMateRules": [
// 太字
{ "scope": "markup.bold.markdown", "settings": { "foreground": "#222222", "fontStyle": "bold" } },
{ "scope": "punctuation.definition.bold.markdown", "settings": { "foreground": "#222222", "fontStyle": "bold" } },
// 見出し部分
// ”# 見出し" の # 部分の色
{ "scope": "punctuation.definition.heading.markdown", "settings": { "foreground": "#4599C4", "fontStyle": "bold" } },
@mehori
mehori / read_ruinenchi.py
Created April 5, 2024 13:40
生物季節観測累年値ファイル(CSV) をパースする Python スクリプト
# 生物季節観測累年値ファイル(CSV) をパースして、「年 1月1日からの日数」に変換する
# https://www.data.jma.go.jp/sakura/data/download_ruinenchi.html
# replace には全角スペースを入れておくようにする
import codecs
def readData(file, station):
with codecs.open(file, "r", encoding="shift_jis") as ifile:
for line in ifile:
line = line.strip()
line = line.replace(" ", "")
'reinit'
'set display color white'
'c'
'sdfopen composite_z500.nc'
'set mproj scaled'
'set mpdraw off'
* 仮想ページを作成、8.5x11in のキャンバスに、この範囲を仮想的にページをする
* 複数の図を掲載する場合は、一つ一つをvpageにして並べる
'set vpage 0.0 7.0 0.0 7.0'
@mehori
mehori / 00convert.sh
Created October 17, 2023 02:43
時間軸がsnapshotになっているNetCDFファイルを、GrADSで読み込めるようにする
#!/bin/bash
ifile=composite_z500.nc
ofile=out.nc
ncks -O --mk_rec_dmn snapshot $ifile tmp.nc # snapshotをunlimited 次元にしてる
ncrename -O -d snapshot,time tmp.nc # snapshot を time に
cdo settaxis,1981-01-01,00:00:00,1day tmp.nc tmp2.nc # time のカレンダー変更
cdo chname,snap_var129,b tmp2.nc $ofile # snap_var129 を b に
@mehori
mehori / draw-ncl.sh
Created February 9, 2023 08:35
大量の図をbashスクリプトで作図するときのテンプレート
#!/bin/bash
# draw a figure
function draw_figure(){
local ifile=$1 # local にしておくと、うっかり同じ変数名を
local mon=$2 # 使ってしまったときも安心
local ofile=$3
echo "draw: $ifile, $ofile, $mon"
cat > tmp.ncl << EOF # ここからEOFまでをtmp.nclというファイルに入れる
@mehori
mehori / ncl-dimension-check.ncl
Created February 9, 2023 08:25
NCLで一番ありがちな「次元が違います」「メタデータがありません」エラーをチェックする
begin
f1 = addfile("sample1.nc","r")
f2 = addfile("sample2.nc","r")
v1 = f1->v(0,:,:) ; 0 にした次元は落ちるので、2次元になる
v2 = f2->v(0,:,:)
printVarSummary(v1) ; 次元を表示してチェック
diff = (v2 - v1) - 273.15 ; 算数をするとメタデータが消えたりするので