#!/usr/bin/perl $magsynopexe = "/home/arta/Dev/STAGING/bin/_linux4/magsynop"; #$magsynopexe = "/home/arta/Dev/STAGING/bin/_sgi4/magsynop"; $rootdir = "/synoptic/carrot"; my($cr); my($s); my($f); my($skipRM) = "no"; my(%cList) = undef; my($doCList) = "no"; my($aidx) = 0; my($arg); my($oneC); while ($arg = shift(@ARGV)) { if ($aidx == 0) { $cr = $arg; } elsif ($aidx == 1) { $s = $arg; } elsif ($aidx == 2) { $f = $arg; } else { if ($arg eq "-s" || $arg eq "-S") { $skipRM = "skiprm"; } elsif ($arg =~ /^\-c(.+)/) { my(@cListArr) = split(',', $1); while (defined($oneC = shift(@cListArr))) { $cList{$oneC} = $oneC; } $doCList = "yes"; } } $aidx++; } #$SYNOPDIR = "$rootdir/M/$cr" . "_arta"; $SYNOPDIR = "$rootdir/M/$cr"; system("mkdir -p $SYNOPDIR"); #$MAGDIR = "$rootdir/fd_M_96m_01d_arta"; $MAGDIR = "$rootdir/fd_M_96m_01d"; #$REMAPDIR = "$rootdir/fd_M_remap_96m_01d_arta"; $REMAPDIR = "$rootdir/fd_M_remap_96m_01d"; #$ENV{'mdi'} = "wd:$rootdir/{series}_arta/{series}.{#%06d#series}"; $ENV{'mdi'} = "wd:$rootdir/{series}/{series}.{#%06d#series}"; $s = sprintf("%d", $s); $ss = $s - 4; $f = sprintf("%d", $f); $ff = $f + 4; if ($skipRM ne "skiprm") { system("mkdir -p $MAGDIR"); system("mkdir -p $REMAPDIR"); foreach $d ($ss .. $ff) { # if (-d "$REMAPDIR/fd_M_remap_96m_01d.00$d") { next; } system("mkdir -p $REMAPDIR/fd_M_remap_96m_01d.00$d"); system("/bin/cp -r /mag/fd_M_96m_01d.00$d $MAGDIR"); system("uncompress $MAGDIR/fd_M_96m_01d.00$d/*Z"); system("v2helio z=1 MOFFSET=0 MCORLEV=1 VCORLEV=0 MAPRMAX=0.994 MAPLGMAX=90 MAPLGMIN=-90 MAPBMAX=90 LGSHIFT=2 MAPMMAX=1800 SINBDIVS=540 CARRSTRETCH=1 in=prog:mdi,level:lev1.8,series:fd_M_96m_01d\[$d\] out=prog:mdi,level:lev1.8,series:fd_M_remap_96m_01d\[$d\]"); system("rm -r $MAGDIR/fd_M_96m_01d.00$d"); } } my($incr) = 15; my($nOffcenter) = 4; my($idx); my($cmdln); my($center); my($sign); my($ewIdx); my($offCStr); my($cmd); for ($ewIdx = 0; $ewIdx < 2; $ewIdx++) { if ($ewIdx == 0) { $sign = -1; $idx = 0; } else { $sign = 1; $idx = 1; } for (; $idx <= $nOffcenter; $idx++) { $center = $idx * $incr * $sign; if ($center == 0) { $offCStr = 0; } elsif ($sign == -1) { $offCStr = $idx * $incr . "E"; } else { $offCStr = $idx * $incr . "W"; } # skip charts that were not requested on cmd-line if ($doCList eq "yes") { if (!defined($cList{$offCStr})) { next; } } $ss = $s + ($sign * $idx); $ff = $f + ($sign * $idx); $cmdln = "CR=$cr checkqual=1 qualmask=0x402c01f2 center=$center nsig=3.0 -f in=prog:mdi,level:lev1.8,series:fd_M_remap_96m_01d\[$ss-$ff\] out=$SYNOPDIR "; $cmd = $magsynopexe . " " . $cmdln . " 2>1 > $SYNOPDIR/synop_UNK.$cr.log"; print(, $cmd . "\n"); system($cmd); # check to see what types of magnetograms produced (radial, los?) # possibilites are: M || Mr. The latter may include a Ml synop, # which was converted from the Mr synop. if (-e "$SYNOPDIR/synop_M.$cr.fits") { # type is M $mtype = "M"; $cmd = "mv $SYNOPDIR/synop_M.$cr.fits $SYNOPDIR/synop_M_$offCStr.$cr.fits"; print(, $cmd . "\n"); system($cmd); } else { # type is Mr $mtype = "Mr"; $cmd = "mv $SYNOPDIR/synop_Mr.$cr.fits $SYNOPDIR/synop_Mr_$offCStr.$cr.fits"; print(, $cmd . "\n"); system($cmd); # might be an Ml too if (-e "$SYNOPDIR/synop_Ml.$cr.fits") { $cmd = "mv $SYNOPDIR/synop_Ml.$cr.fits $SYNOPDIR/synop_Ml_$offCStr.$cr.fits"; print(, $cmd . "\n"); system($cmd); } } # oddly enough, having _$mtype_$offCStr in a string doesn't work, so concatenate # two strings. # rename log appropriately $cmd = "mv $SYNOPDIR/synop_UNK.$cr.log $SYNOPDIR/synop_$mtype" . "_$offCStr.$cr.log"; print(, $cmd . "\n"); system($cmd); # rename w and epts files appropriately $cmd = "mv $SYNOPDIR/wt_$mtype.$cr.fits $SYNOPDIR/wt_$mtype" . "_$offCStr.$cr.fits"; print(, $cmd . "\n"); system($cmd); $cmd = "mv $SYNOPDIR/epts_$mtype.$cr.fits $SYNOPDIR/epts_$mtype" . "_$offCStr.$cr.fits"; print(, $cmd . "\n"); system($cmd); } } system("gzip $SYNOPDIR/*.log"); if ($skipRM ne "skiprm") { system("rm -r $REMAPDIR/*"); }