subroutine load_jmara_grib2(filepath, result)
implicit none
character(*), intent(in) :: filepath
integer, parameter :: len_sec0 = 16, len_sec1 = 21, len_sec2 = 0
integer, parameter :: len_sec3 = 72, len_sec4 = 82, len_sec6 = 6
integer :: len_sec5, pos, filesize
integer, parameter :: x_n = 2560, y_n = 3360
integer(1), allocatable :: binary(:)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$agency = Import-Csv .\agency.txt | Select-Object agency_id, agency_name | |
$trips=@{}; Import-Csv .\trips.txt | %{$trips[$_.trip_id] = @{"route_id" = $_.route_id; "service_id"= $_.service_id; "direction_id"= $_.direction_id}} | |
$stops=@{}; Import-Csv .\stops.txt | %{$stops[$_.stop_id] = $_.stop_name} | |
$route_long_name=@{}; Import-Csv .\routes.txt | %{$route_long_name[$_.route_id] = $_.route_long_name} | |
$stop_times = Import-Csv .\stop_times.txt | Select-Object trip_id, stop_id, departure_time, stop_headsign | |
$out = foreach ($stop_time in $stop_times){ | |
$trip = $trips[$stop_time.trip_id] | |
[PSCustomObject]@{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import time, datetime | |
from bleak import BleakClient, discover | |
from functools import reduce | |
def crc8(payload: bytearray): | |
polynomial = 0x85 | |
def crc1(crc, times=0): | |
if times >= 8: | |
return crc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
To install Windows 10 WinRT API Pack to Powershell, type the following. | |
PS> Find-PackageProvider -Force | |
PS> Find-package -Name "Microsoft.Windows.SDK.Contracts" -Source https://www.nuget.org/api/v2 | Install-Package -Force | |
#> | |
# https://fleexlab.blogspot.com/2018/02/using-winrts-iasyncoperation-in.html | |
Add-Type -AssemblyName System.Runtime.WindowsRuntime | |
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | Where-Object { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0] | |
function Await($WinRtTask, $ResultType) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@shutdown /r /fw /t 0 2>&0 || powershell saps %~0 -verb runas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
''' | |
国土地理院 作業規則の準則 付録6 計算式集 2.9 平成25年改訂 | |
https://psgsv2.gsi.go.jp/koukyou/jyunsoku/pdf/h28/h28_junsoku_furoku6.pdf#page=22 | |
政春尋志, 地図投影法 ―地理空間情報の技法―, 朝倉書店, 2011, ISBN 978-4-254-16348-3 | |
https://www.asakura.co.jp/books/isbn/978-4-254-16348-3/ | |
''' | |
def xy_to_latlon(X, Y, dglat0, dglon0): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def to_meshcode(lat, lon, EF=5): | |
''' | |
経度・緯度のndarrayを受け取り、 | |
メッシュコードのndarrayを返す | |
EFは入力座標値の小数点以下の桁数-1を与える | |
''' | |
p, pmod = np.divmod(np.round(lat * 1.5, EF), 1) |