#!/usr/bin/perl # Extract Antarctic data from IMMA records use strict; use warnings; use lib "/home/hc1300/hadpb/tasks/digitisation/imma/"; use IMMA; use FindBin; use Time::Local; my $Year = $ARGV[0]; for ( my $i = 1 ; $i <= 12 ; $i++ ) { my $Yr = $Year; my $Month = $i + 6; if ( $Month > 12 ) { $Month -= 12; $Yr++; } open( DIN, sprintf "/var/tmp/hadpb/IMMA.%04d.%02d", $Yr, $Month ) or die "No obs for $Yr $Month"; lo_ob: while ( my $ob = imma_read( \*DIN ) ) { foreach (qw(YR MO DY HR LAT LON)) { unless ( defined( $ob->{$_} ) ) { next lo_ob; } } # Antarctic data only if ( $ob->{LAT} >= -55 ) { next lo_ob; } # Discard traffic round Cape Horn if ( $ob->{LON} > 200 && $ob->{LON} < 320 && $ob->{LAT} > -63 ) { next lo_ob; } $ob->write( \*STDOUT ); } close(DIN); }