Skip to content

Instantly share code, notes, and snippets.

@Gro-Tsen
Last active February 11, 2022 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gro-Tsen/427ccc61453ba06f3726148c33d50c0e to your computer and use it in GitHub Desktop.
Save Gro-Tsen/427ccc61453ba06f3726148c33d50c0e to your computer and use it in GitHub Desktop.
*** 2022-01-21
2022-01-14,545,2190
2022-01-15,473,2157
2022-01-16,436,2088
2022-01-17,528,2420
2022-01-18,437,2325
2022-01-19,437,2321
2022-01-20,338,1780
*** 2022-01-22
2022-01-14,545,2188
2022-01-15,473,2156
2022-01-16,436,2093
2022-01-17,528,2425
2022-01-18,437,2330
2022-01-19,437,2393
2022-01-20,338,2195
2022-01-21,402,1816
*** 2022-01-23
2022-01-14,545,2188
2022-01-15,473,2156
2022-01-16,436,2094
2022-01-17,528,2426
2022-01-18,436,2333
2022-01-19,441,2397
2022-01-20,403,2250
2022-01-21,468,2250
2022-01-22,310,1720
*** 2022-01-24
2022-01-14,545,2188
2022-01-15,473,2156
2022-01-16,436,2094
2022-01-17,528,2427
2022-01-18,436,2333
2022-01-19,441,2400
2022-01-20,403,2256
2022-01-21,469,2280
2022-01-22,356,2017
2022-01-23,245,1601
*** 2022-01-25
2022-01-14,545,2188
2022-01-15,473,2156
2022-01-16,436,2094
2022-01-17,528,2427
2022-01-18,438,2346
2022-01-19,441,2415
2022-01-20,406,2288
2022-01-21,478,2373
2022-01-22,390,2173
2022-01-23,298,1989
2022-01-24,333,1744
*** 2022-01-26
2022-01-14,545,2221
2022-01-15,473,2181
2022-01-16,436,2109
2022-01-17,528,2455
2022-01-18,438,2361
2022-01-19,441,2440
2022-01-20,407,2330
2022-01-21,480,2430
2022-01-22,391,2222
2022-01-23,305,2083
2022-01-24,390,2229
2022-01-25,314,1754
*** 2022-01-27
2022-01-14,545,2221
2022-01-15,473,2181
2022-01-16,436,2109
2022-01-17,528,2455
2022-01-18,438,2361
2022-01-19,441,2437
2022-01-20,407,2332
2022-01-21,480,2448
2022-01-22,391,2228
2022-01-23,308,2103
2022-01-24,393,2279
2022-01-25,356,2166
2022-01-26,266,1603
*** 2022-01-28
2022-01-14,545,2226
2022-01-15,473,2187
2022-01-16,436,2111
2022-01-17,528,2460
2022-01-18,438,2364
2022-01-19,441,2447
2022-01-20,407,2335
2022-01-21,480,2475
2022-01-22,391,2240
2022-01-23,308,2122
2022-01-24,394,2314
2022-01-25,357,2224
2022-01-26,322,2040
2022-01-27,259,1576
*** 2022-01-29
2022-01-14,545,2226
2022-01-15,473,2187
2022-01-16,436,2111
2022-01-17,528,2460
2022-01-18,437,2363
2022-01-19,441,2447
2022-01-20,403,2331
2022-01-21,480,2475
2022-01-22,391,2244
2022-01-23,308,2130
2022-01-24,393,2344
2022-01-25,357,2265
2022-01-26,322,2109
2022-01-27,304,1998
2022-01-28,275,1560
*** 2022-01-30
2022-01-14,545,2226
2022-01-15,473,2187
2022-01-16,436,2111
2022-01-17,528,2460
2022-01-18,437,2363
2022-01-19,441,2447
2022-01-20,403,2331
2022-01-21,480,2475
2022-01-22,391,2245
2022-01-23,308,2132
2022-01-24,393,2347
2022-01-25,357,2267
2022-01-26,322,2121
2022-01-27,305,2052
2022-01-28,308,1959
2022-01-29,206,1449
*** 2022-01-31
2022-01-14,545,2226
2022-01-15,473,2187
2022-01-16,436,2111
2022-01-17,528,2460
2022-01-18,437,2363
2022-01-19,441,2447
2022-01-20,403,2331
2022-01-21,480,2475
2022-01-22,391,2245
2022-01-23,308,2132
2022-01-24,393,2348
2022-01-25,357,2267
2022-01-26,322,2124
2022-01-27,305,2055
2022-01-28,312,2010
2022-01-29,251,1860
2022-01-30,185,1272
*** 2022-02-01
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2358
2022-01-25,359,2271
2022-01-26,327,2131
2022-01-27,307,2079
2022-01-28,323,2117
2022-01-29,255,1962
2022-01-30,221,1716
2022-01-31,223,1496
*** 2022-02-02
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2360
2022-01-25,359,2272
2022-01-26,327,2140
2022-01-27,308,2088
2022-01-28,322,2134
2022-01-29,255,2001
2022-01-30,222,1763
2022-01-31,265,1901
2022-02-01,206,1378
*** 2022-02-03
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2360
2022-01-25,359,2272
2022-01-26,327,2140
2022-01-27,308,2103
2022-01-28,322,2159
2022-01-29,255,2024
2022-01-30,222,1802
2022-01-31,267,2022
2022-02-01,241,1829
2022-02-02,172,1342
*** 2022-02-04
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2360
2022-01-25,359,2272
2022-01-26,327,2140
2022-01-27,308,2104
2022-01-28,323,2169
2022-01-29,255,2032
2022-01-30,222,1812
2022-01-31,268,2057
2022-02-01,251,1881
2022-02-02,225,1709
2022-02-03,166,1272
*** 2022-02-06
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2360
2022-01-25,359,2272
2022-01-26,327,2140
2022-01-27,308,2104
2022-01-28,323,2169
2022-01-29,255,2028
2022-01-30,223,1815
2022-01-31,268,2069
2022-02-01,252,1907
2022-02-02,225,1770
2022-02-03,199,1668
2022-02-04,216,1643
2022-02-05,160,1166
*** 2022-02-07
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2360
2022-01-25,359,2272
2022-01-26,327,2140
2022-01-27,308,2104
2022-01-28,323,2169
2022-01-29,255,2028
2022-01-30,223,1815
2022-01-31,270,2072
2022-02-01,253,1910
2022-02-02,225,1775
2022-02-03,199,1678
2022-02-04,217,1667
2022-02-05,183,1401
2022-02-06,133,1035
*** 2022-02-08
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2368
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2136
2022-01-24,400,2360
2022-01-25,359,2272
2022-01-26,327,2140
2022-01-27,308,2104
2022-01-28,323,2169
2022-01-29,255,2028
2022-01-30,223,1815
2022-01-31,270,2072
2022-02-01,254,1914
2022-02-02,226,1785
2022-02-03,200,1693
2022-02-04,218,1751
2022-02-05,184,1495
2022-02-06,153,1281
2022-02-07,146,1158
*** 2022-02-09
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2370
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2138
2022-01-24,400,2361
2022-01-25,359,2273
2022-01-26,327,2144
2022-01-27,308,2105
2022-01-28,323,2169
2022-01-29,255,2028
2022-01-30,223,1815
2022-01-31,270,2075
2022-02-01,254,1923
2022-02-02,226,1790
2022-02-03,200,1698
2022-02-04,218,1776
2022-02-05,184,1516
2022-02-06,155,1324
2022-02-07,167,1470
2022-02-08,140,991
*** 2022-02-10
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2370
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2138
2022-01-24,400,2361
2022-01-25,359,2273
2022-01-26,327,2144
2022-01-27,308,2105
2022-01-28,323,2169
2022-01-29,255,2028
2022-01-30,223,1815
2022-01-31,270,2075
2022-02-01,254,1923
2022-02-02,226,1790
2022-02-03,200,1706
2022-02-04,218,1785
2022-02-05,184,1526
2022-02-06,155,1340
2022-02-07,167,1536
2022-02-08,167,1361
2022-02-09,114,963
*** 2022-02-11
2022-01-14,546,2227
2022-01-15,474,2188
2022-01-16,437,2112
2022-01-17,530,2462
2022-01-18,442,2370
2022-01-19,444,2450
2022-01-20,406,2334
2022-01-21,487,2482
2022-01-22,396,2250
2022-01-23,312,2138
2022-01-24,400,2361
2022-01-25,359,2273
2022-01-26,327,2144
2022-01-27,308,2105
2022-01-28,323,2169
2022-01-29,255,2028
2022-01-30,223,1815
2022-01-31,270,2075
2022-02-01,254,1923
2022-02-02,226,1790
2022-02-03,200,1706
2022-02-04,218,1786
2022-02-05,184,1531
2022-02-06,155,1342
2022-02-07,167,1542
2022-02-08,170,1396
2022-02-09,129,1212
2022-02-10,105,962
#! /usr/local/bin/perl -w
use strict;
use warnings;
use Date::Calc qw(check_date Date_to_Days Add_Delta_Days);
use Getopt::Std;
my %opts;
getopts('t', \%opts);
my %data_idf;
my %data_france;
my @alldelays;
my $report_julian;
while (<>) {
if ( m/^\*\*\*\s*([0-9]{4})-([0-9]{2})-([0-9]{2})\s*$/ ) {
die "Invalid date" unless check_date($1,$2,$3);
$report_julian = Date_to_Days($1,$2,$3) + 1721425;
} elsif ( m/^\s*([0-9]{4})-([0-9]{2})-([0-9]{2})\s*\,\s*([0-9]+)\s*\,\s*([0-9]+)\s*$/ ) {
die "Missing report date" unless defined($report_julian);
die "Invalid date" unless check_date($1,$2,$3);
my $value_julian = Date_to_Days($1,$2,$3) + 1721425;
my $idf_value = $4 + 0;
my $france_value = $5 + 0;
my $delay = $report_julian - $value_julian;
die "Delay is negative" if $delay <= 0;
$data_idf{$value_julian}[$delay] = $idf_value;
$data_france{$value_julian}[$delay] = $france_value;
$alldelays[$delay] = 1;
}
}
if ( $opts{t} ) {
for ( my $i=0 ; $i<scalar(@alldelays) ; $i++ ) {
next unless $alldelays[$i];
printf ("Reported at J+%d:\n", $i);
foreach my $d ( sort {$a <=> $b} keys(%data_idf) ) {
next unless defined($data_idf{$d}[$i]);
my ($year,$month,$day) = Add_Delta_Days(1,1,1, $d - 1721425 - 1);
my ($ultimate_idf, $ultimate_france);
my $len = scalar(@{$data_idf{$d}});
die "This is impossible" unless scalar(@{$data_france{$d}}) == $len;
$ultimate_idf = $data_idf{$d}[$len-1];
$ultimate_france = $data_france{$d}[$len-1];
die "This is impossible" unless defined($ultimate_idf) && defined($ultimate_france);
if ( $len >=4 ) {
printf ("\tfor %04d-%02d-%02d (day %d): %d,%d (%.1f%%,%.1f%%)\n", $year, $month, $day, $d, $data_idf{$d}[$i], $data_france{$d}[$i], $data_idf{$d}[$i]/$ultimate_idf*100, $data_france{$d}[$i]/$ultimate_france*100);
} else {
printf ("\tfor %04d-%02d-%02d (day %d): %d,%d\n", $year, $month, $day, $d, $data_idf{$d}[$i], $data_france{$d}[$i]);
}
}
}
} else {
foreach my $d ( sort {$a <=> $b} keys(%data_idf) ) {
my ($year,$month,$day) = Add_Delta_Days(1,1,1, $d - 1721425 - 1);
printf ("For %04d-%02d-%02d (day %d)\n", $year, $month, $day, $d);
my ($ultimate_idf, $ultimate_france);
my $len = scalar(@{$data_idf{$d}});
die "This is impossible" unless scalar(@{$data_france{$d}}) == $len;
$ultimate_idf = $data_idf{$d}[$len-1];
$ultimate_france = $data_france{$d}[$len-1];
die "This is impossible" unless defined($ultimate_idf) && defined($ultimate_france);
for ( my $i=0 ; $i<scalar(@{$data_idf{$d}}) ; $i++ ) {
next unless defined($data_idf{$d}[$i]);
if ( $len >=4 ) {
printf ("\treported at J+%d: %d,%d (%.1f%%,%.1f%%)\n", $i, $data_idf{$d}[$i], $data_france{$d}[$i], $data_idf{$d}[$i]/$ultimate_idf*100, $data_france{$d}[$i]/$ultimate_france*100);
} else {
printf ("\treported at J+%d: %d,%d\n", $i, $data_idf{$d}[$i], $data_france{$d}[$i]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment