#!/usr/bin/perl $v2helioexe = "/home/soi/CM/bin/_linux4/v2helio"; $fdradialexe = "/home/soi/CM/bin/_linux4/fdradial"; $rootdir = "/home/jeneen/foo.yanli"; my($cr); my($s); my($f); my($skipRM) = "no"; my($skipRemove) = "no"; my(%cList) = undef; my($doCList) = "no"; my($aidx) = 0; my($arg); my($oneC); my($cmdln); $SYNOPDIR = "$rootdir/$ARGV[0]"; system("mkdir -p $SYNOPDIR"); $MAGDIR = "$rootdir/fd_M_96m_01d"; #$RADIALDIR = "$rootdir/fd_M_radial_96m_01d_arta"; $RADIALDIR = "$rootdir/fd_M_radial_96m_01d"; # Non-differential-rotatation-adjusted images #$REMAPDIR = "$rootdir/fd_M_remap_96m_01d_arta"; $REMAPDIR = "$rootdir/fd_M_remap_96m_01d"; # Differential-rotatation-adjusted images #$DREMAPDIR = "$rootdir/fd_M_dremap_96m_01d_arta"; $DREMAPDIR = "$rootdir/fd_M_dremap_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 - 5; $f = sprintf("%d", $f); $ff = $f + 5; open(LOGFILE, ">>$SYNOPDIR/make_magsynop.$cr.log"); if ($skipRM ne "skiprm") { system("mkdir -p $MAGDIR"); system("mkdir -p $RADIALDIR"); system("mkdir -p $REMAPDIR"); system("mkdir -p $DREMAPDIR"); foreach $d ($ss .. $ff) { # if (-d "$REMAPDIR/fd_M_remap_96m_01d.00$d") { next; } system("mkdir -p $RADIALDIR/fd_M_radial_96m_01d.00$d"); system("mkdir -p $REMAPDIR/fd_M_remap_96m_01d.00$d"); system("mkdir -p $DREMAPDIR/fd_M_dremap_96m_01d.00$d"); system("/bin/cp -r /mag/fd_M_96m_01d.00$d $MAGDIR"); # Do radial conversion $cmdln = "$fdradialexe RADIALCORR=1 in=prog:mdi,level:lev1.8,series:fd_M_96m_01d\[$d\] out=prog:mdi,level:lev1.8,series:fd_M_radial_96m_01d\[$d\]"; print(, $cmdln . "\n"); print LOGFILE $cmdln . "\n"; system($cmdln); # Don't adjust for differential rotation $cmdln = "$v2helioexe z=1 MOFFSET=0 MCORLEV=0 VCORLEV=0 MAPRMAX=0.994 MAPLGMAX=90 MAPLGMIN=-90 MAPBMAX=90 LGSHIFT=2 MAPMMAX=1800 SINBDIVS=540 CARRSTRETCH=0 in=prog:mdi,level:lev1.8,series:fd_M_radial_96m_01d\[$d\] out=prog:mdi,level:lev1.8,series:fd_M_remap_96m_01d\[$d\]"; print(, $cmdln . "\n"); print LOGFILE $cmdln . "\n"; system($cmdln); # Adjust for differential rotation $cmdln = "$v2helioexe z=1 MOFFSET=0 MCORLEV=0 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_radial_96m_01d\[$d\] out=prog:mdi,level:lev1.8,series:fd_M_dremap_96m_01d\[$d\]"; print(, $cmdln . "\n"); print LOGFILE $cmdln . "\n"; system($cmdln); if($skipRemove ne "skipremove") { system("rm -r $MAGDIR/fd_M_96m_01d.00$d"); } } } my($incr) = 15; my($nOffcenter) = 4; my($idx); 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); # add one day to each end $ss = $ss - 1; $ff = $ff + 1; if ($center == 0) { # Remapped images are adjusted for differential rotation $cmdln = "CR=$cr checkqual=1 qualmask=0x402c01f2 center=$center nsig=3.0 -l in=prog:mdi,level:lev1.8,series:fd_M_dremap_96m_01d\[$ss-$ff\] out=$SYNOPDIR "; } else { # Remapped images are NOT adjusted for differential rotation $cmdln = "CR=$cr checkqual=1 qualmask=0x402c01f2 center=$center nsig=3.0 -l 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"); print LOGFILE $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"); print LOGFILE $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"); print LOGFILE $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"); print LOGFILE $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"); print LOGFILE $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"); print LOGFILE $cmd . "\n"; system($cmd); $cmd = "mv $SYNOPDIR/epts_$mtype.$cr.fits $SYNOPDIR/epts_$mtype" . "_$offCStr.$cr.fits"; print(, $cmd . "\n"); print LOGFILE $cmd . "\n"; system($cmd); } } close(LOGFILE); system("gzip $SYNOPDIR/*.log"); if ($skipRM ne "skiprm") { if($skipRemove ne "skipremove") { system("rm -r $RADIALDIR/*"); system("rm -r $REMAPDIR/*"); system("rm -r $DREMAPDIR/*"); } }