25c25 < ! mxtimes only used for ASTRA and for SuperDARN, and inmin used only for SuperDARN --- > ! mxtimes and inmin only used for ASTRA and for SuperDARN 29,34c29,34 < ! | mxtimes = 289, ! maximum number of times of AMIE data per file (Dec 13,14,15 5 min) + 1 for 0UT < ! | lonmx = 180, ! maximum number of longitudes of AMIE data (1 less than grid), but SWMF is lonp1! < ! | ithtrns = 89, ! corresponding to trans lat 1 mlat number of AMIE lats minus 1 < ! | ithmx = 91, ! max number of AMIE mlats (90/(5/3)=54+1) to equator < ! | ifpole = 1, ! ifpole=1,0 if do,not have pole as endpoints < ! | inmin = 15, ! number of minutes between inputs, used only for SD --- > | mxtimes = 289, ! maximum number of times of AMIE data per file (Dec 13,14,15 5 min) + 1 for 0UT > | lonmx = 180, ! maximum number of longitudes of AMIE data (1 less than grid), but SWMF is lonp1! > | ithtrns = 89, ! corresponding to trans lat 1 mlat number of AMIE lats minus 1 > | ithmx = 91, ! max number of AMIE mlats (90/(5/3)=54+1) to equator > | ifpole = 1, ! ifpole=1,0 if do,not have pole as endpoints > | inmin = 15, ! number of minutes between inputs, used only for corr SD and ASTRA 42c42 < ! | inmin = 5, ! number of minutes between inputs, used only for SD --- > ! | inmin = 5, ! number of minutes between inputs, used only for corr SD and ASTRA 50c50 < ! | inmin = 1, ! number of minutes between inputs, used only for SD --- > ! | inmin = 1, ! number of minutes between inputs, used only for corr SD and ASTRA 57c57 < ! | inmin = 1, ! number of minutes between inputs, used only for SD --- > ! | inmin = 1, ! number of minutes between inputs, used only for corr SD and ASTRA 65c65 < ! | inmin = 10, ! number of minutes between inputs, used only for SD --- > ! | inmin = 10, ! number of minutes between inputs, used only for corr SD and ASTRA 68,84c68,73 < ! After 23 Apr 2014, VT SD has begin and end times of 0002(-0004) and 2356(-2358) since < ! inmin cadence is really the default 2 min chunks every inmin minutes < ! Sometimes, especially in the SH, the end 2min chunk of time is 2354(-2356) instead of 2356. < ! If SH missing 2356UT for inmin=2, then should duplicate 2354ut, revise UT to 2356ut, < ! and cat it on end of daily file to have the same number of UT times as the NH < | mxtimes = 570, ! maximum number of times of AMIE data per file (Dec 13-16 10 min - 20min ~0UT) + 2 for endpts < ! | mxtimes = 722, ! maximum number of times of AMIE data per file 72_20m*10d=720+2 < ! | mxtimes = 1438, ! maximum number of times of AMIE data per file 718_2m*2d=1436+2 < ! | mxtimes = 2874, ! maximum number of times of AMIE data per file 718_2m*4d=2872+2 < ! | mxtimes = 218, ! maximum number of times of AMIE data per file 72_20m*3d=216+2 < | lonmx = 180, ! maximum number of longitudes of AMIE data (1 less than grid) < | ithtrns = 40, ! corresponding to trans lat 50 mlat number of AMIE lats minus 1 + pole < | ithmx = 91, ! max number of AMIE mlats (90/1deg=90+1) to equator < | ifpole = 0, ! ifpole=1,0 if do,not have pole as endpoints < | inmin = 10, ! number of minutes between inputs, used only for SD < ! | inmin = 20, ! number of minutes between inputs, used only for SD < ! | inmin = 2, ! number of minutes between inputs, used only for SD --- > ! | mxtimes = 570, ! maximum number of times of AMIE data per file (Dec 13-16 10 min - 20min ~0UT) + 2 for endpts > ! | lonmx = 180, ! maximum number of longitudes of AMIE data (1 less than grid) > ! | ithtrns = 40, ! corresponding to trans lat 50 mlat number of AMIE lats minus 1 + pole > ! | ithmx = 91, ! max number of AMIE mlats (90/1deg=90+1) to equator > ! | ifpole = 0, ! ifpole=1,0 if do,not have pole as endpoints > ! | inmin = 10, ! number of minutes between inputs, used only for corr SD and ASTRA 114,117c103,105 < ! 4/14 bae: save daynum amie_day, and minutes in day amie_min < integer,dimension(mxtimes),private :: amie_day < real,dimension(mxtimes),private :: amie_min < --- > ! 4/14 bae: 3 amie_dhm (daynumber,hour,minute) to 1 (daynum, minutes) > ! to allow for irregularly spaced 10 or 12 min VT SD 129x/day (not 144x!) > integer,dimension(mxtimes,2),private :: amie_dhm 141,142c129,130 < integer :: nl,ifstop,j1,j2 < real :: lblat,glat,glon,mlon,depot,polekvs,polekvn,delmin,rinmin --- > integer :: nl,delmin,ifstop,j1,j2 > real :: lblat,glat,glon,mlon,depot,polekvs,polekvn 254,257c242,245 < amie_day(nt) = nda < amie_min(nt) = ih*60 + imin + isec/60. < ! write (6,"(1x,'nt dayn hr min sec minpd = ',5i5,f9.2)") < ! | nt,nda,ih,imin,isec,amie_min(2) --- > amie_dhm(nt,1) = nda > amie_dhm(nt,2) = ih*60 + imin > ! write (6,"(1x,'nt dayn hr min minpd = ',5i5)") > ! | nt,nda,ih,imin,amie_dhm(nt,2) 273c261 < ! TEMP find HP and min-max and print out CP and time to fort.52 --- > ! TEMP find HP and min-max and print out CP and time to fort.51 294,295c282,283 < write (52,"(i4,2i5,7f9.2)") nt,iy,amie_day(nt), < | amie_min(nt),epot_xsh-epot_nsh, --- > write (52,"(i4,i5,i4,i5,6f8.2)") nt,iy,amie_dhm(nt,1), > | amie_dhm(nt,2),epot_xsh-epot_nsh, 316,319c304,309 < delmin = amie_min(2) - amie_min(1) < ! TEMP!! Extrapolate to 24 UT at end of time (ie to 17 Dec 2006 from 16 Dec) for ASTRA < amie_day(mxtimes) = amie_day(mxtimes-1)+1 < amie_min(mxtimes) = 0 --- > ! TEMP > ! stop > delmin = amie_dhm(2,2) - amie_dhm(1,2) > ! Extrapolate to 24 UT at end of time (ie to 17 Dec 2006 from 16 Dec) > amie_dhm(mxtimes,1) = amie_dhm(mxtimes-1,1)+1 > amie_dhm(mxtimes,2) = 0 331,334c321,323 < | ' every delmin minutes =',i4,3(1x,i4,f9.2),f7.2)") < | mxtimes,amie_day(1),amie_min(1),amie_day(mxtimes-1), < | amie_min(mxtimes-1),amie_day(mxtimes), amie_min(mxtimes), < | delmin --- > | ' every delmin minutes =',i4,2x,2i5,1x,2i5,1x,2i5,i3)") > | mxtimes,(amie_dhm(1,i),i=1,2),(amie_dhm(mxtimes-1,j),j=1,2), > | (amie_dhm(mxtimes,jt),jt=1,2),delmin 407,408d395 < read (ls_amie,"(2x,i4,5(1x,i2))") iy,imo,ida,ih,imin,isec < ! Read NH last since VT first time 0002 or last time 2356 can be different for SH w less data 409a397 > read (ls_amie,"(2x,i4,5(1x,i2))") iy,imo,ida,ih,imin,isec 417,434c405,408 < amie_day(nt) = nda < amie_min(nt) = ih*60 + imin + isec/60. + inmin/2. ! Corrected for inmin/2 midpt < if (iamie==6) then < ! Correct for endpoints of day at 0002-0004 and 2356-2358 for any inmin but 2 min (the default chunk size) < ! If SH missing 2356UT for inmin=2, then should duplicate 2354ut, revise UT to 2356ut, < ! and cat it on end of daily file to have the same number of UT times as the NH < if (ih==0 .and. imin==2 .and. inmin.ne.2) < | amie_min(nt) = ih*60 + imin + (inmin-2)/2. < if (ih==23 .and. imin==60-2*inmin .and. inmin.ne.2) < | amie_min(nt) = ih*60 + imin + (56-imin)/2. < if (ih==23 .and. imin==56 .and. inmin.ne.2) < | amie_min(nt) = ih*60 + imin + 1. < endif < if (amie_min(nt).ge.1440.) then < write (6,"(1x,'nt dayn hr min sec minpd(>=1440) = ',5i5, < | f9.2)") nt,nda,ih,imin,isec,amie_min(nt) < stop < endif --- > amie_dhm(nt,1) = nda > amie_dhm(nt,2) = ih*60 + imin + inmin/2 ! Corrected for inmin/2 midpt > ! write (6,"(1x,'nt dayn hr min minpd = ',5i5)") > ! | nt,nda,ih,imin,amie_dhm(nt,2) 456c430 < ! Read VT SD from 50-89mlat and save 89.5 to 50.5 with j=latp1 (1=latp1+1-latp1,latp1+1=2*latp1=1-latp1) for pole --- > ! Read VT SD from 60-89mlat and save 89.5 to 60.5 with j=latp1 (1=latp1+1-latp1,latp1+1=2*latp1=1-latp1) for pole 502c476 < ! TEMP find min-max and print out CP and time to fort.52 --- > ! TEMP find min-max and print out CP and time to fort.51 551c525 < if (nt==2) write (52,"(i1,' iamie Superdarn CP'/ --- > if (nt==2) write (52,"(i1,' iamie Superdarn Dec06 CP'/ 555,556c529,530 < write (52,"(i4,2i5,16f8.2)") nt,iy,amie_day(nt), < | amie_min(nt),epot_xsh-epot_nsh, --- > write (52,"(i4,i5,i4,i5,15f8.2)") nt,iy,amie_dhm(nt,1), > | amie_dhm(nt,2),epot_xsh-epot_nsh, 597,606d570 < < ! Check inmin with times read in < if (nt==4) then < rinmin = amie_min(nt) - amie_min(nt-1) < if (abs(inmin-rinmin)>0.1) then < write (6,"(1x,'STOP: SuperDARN inmin (and mxtimes) bad!', < | ' inmin rinmin =',i4,f8.1)") inmin,rinmin < stop < endif < endif 608c572,574 < ! Add times 1,mxtimes assuming 2min SD chunks so add 1 min --- > ! TEMP > ! stop > ! Add times 1,mxtimes 611,614c577,580 < amie_day(nt1) = amie_day(nt1+1) < amie_min(nt1) = 0 < amie_day(nt2) = amie_day(nt2-1) + 1 < amie_min(nt2) = 0 --- > amie_dhm(nt1,1) = amie_dhm(nt1+1,1) > amie_dhm(nt1,2) = 0 > amie_dhm(nt2,1) = amie_dhm(nt2-1,1) + 1 > amie_dhm(nt2,2) = 0 616c582 < do j=1,latp1*2 --- > do j=1,latp1+latp1+2 622,624c588,590 < | '(daynum,minpd) every delmin minutes =',2i4,2(1x,i4,f9.2), < | i10)") iamie,mxtimes,amie_day(2),amie_min(2), < | amie_day(mxtimes-1),amie_min(mxtimes-1),inmin --- > | '(dn,h,m) every delmin minutes =',2i4,2x,2i5,1x,2i5,i10)") > | iamie,mxtimes,(amie_dhm(2,i),i=1,2),(amie_dhm(mxtimes-1,jt), > | jt=1,2),inmin 672,673c638,639 < integer :: nt,ihem < real :: frac1,frac2,rmodelminpd,amieminpd,amieminpdm1,delmin --- > integer :: nt,ihem,delmin,amieminpd,amieminpdm1,modelminpd > real :: frac1,frac2,rmodelminpd 689d654 < 722a688 > modelminpd = modeltime(2)*60 + modeltime(3) 725,728c691,693 < amieminpdm1 = amie_min(nt-1) < amieminpd = amie_min(nt) < ! Check if go over a day boundary (will not work for Dec 31 to Jan 01!) < if (amie_day(nt-1)==amie_day(nt)-1) then --- > amieminpdm1 = amie_dhm(nt-1,2) > amieminpd = amie_dhm(nt,2) > if (amie_dhm(nt-1,1) .eq. amie_dhm(nt,1)-1) then 730c695 < amieminpdm1 = amieminpdm1 - 1440. --- > amieminpdm1 = amieminpdm1 - 1440 732,736c697,703 < delmin = amieminpd - amie_min(nt-1) < if (amie_day(nt-1)==modeltime(1) .and. amieminpd .ge. < | rmodelminpd .and. amie_min(nt-1) .le. rmodelminpd) go to 100 < if (amie_day(nt)==modeltime(1) .and. amieminpdm1 .le. < | rmodelminpd .and. amie_min(nt) .ge. rmodelminpd) go to 101 --- > delmin = amieminpd - amie_dhm(nt-1,2) > if (amie_dhm(nt-1,1)==modeltime(1) > | .and. amie_dhm(nt-1,2) .le. modelminpd.and. > | amieminpd .ge. modelminpd+modeltime(4)/30) go to 100 > if (amie_dhm(nt,1)==modeltime(1) > | .and. amieminpdm1 .le. modelminpd .and. > | amie_dhm(nt,2) .ge. modelminpd+modeltime(4)/30) go to 101 738,742c705,708 < write (6,"(1x,'Cannot find modeltime in amie_day,min; ', < | 'modeltime rmodelminpd amie_day,min(1,mxtimes) =',4i5,1x,f9.2, < | 1x,i4,f9.2,i6,1x,i4,f9.2)") modeltime,rmodelminpd, < | amie_day(1),amie_min(1),mxtimes,amie_day(mxtimes), < | amie_min(mxtimes) --- > write (6,"(1x,'Cannot find modeltime in amie_dhm; modeltime ', > | 'modelminpd amie_dhm(1,mxtimes) =',4i5,1x,2i5,1x,3i5)") > | modeltime,modelminpd, > | (amie_dhm(1,i),i=1,2),mxtimes,(amie_dhm(mxtimes,j),j=1,2) 744,745c710,711 < ! Use nt and nt-1 for interpolation over delmin or amie_min(nt-1,nt) < 100 frac1 = (amieminpd-rmodelminpd) / delmin --- > ! Use nt and nt-1 for interpolation over delmin or amie_dhm(nt,nt-1) (integer) min > 100 frac1 = (amieminpd-rmodelminpd) / float(delmin) 747c713 < 101 frac1 = (amie_min(nt)-rmodelminpd) / delmin --- > 101 frac1 = (amie_dhm(nt,2)-rmodelminpd) / float(delmin) 750,754c716,720 < write (6,"(1x,'bad: frac1,2 nt-1,nt modeltime rmodelminpd ', < | 'amie_day,min(nt-1,nt) amieminpdm1 amieminpd delmin =',2f7.2, < | 2i5,1x,4i5,1x,f9.2,2(i5,f9.2),3f9.2)") frac1,frac2,nt-1,nt, < | modeltime,rmodelminpd,amie_day(nt-1),amie_min(nt-1), < | amie_day(nt),amie_min(nt),amieminpdm1,amieminpd,delmin --- > write (6,"(1x,'frac1,2 bad; nt-1,nt modeltime modelminpd ', > | 'amie_dhm(nt-1,nt) amieminpdm1 amieminpd delmin =', > | 3f7.2,7i5,1x,7i5)") frac1,frac2,rmodelminpd,nt-1,nt,modeltime, > | modelminpd,(amie_dhm(nt-1,i),i=1,2),(amie_dhm(nt,j),j=1,2), > | amieminpdm1,amieminpd,delmin 758,760c724,726 < write(6,"('Initial frac1,2,nt-1,nt,amie_day,min =',2f7.2,2i5, < | 2(i5,f9.2))") frac1,frac2,nt-1,nt,amie_day(nt-1), < | amie_min(nt-1),amie_day(nt),amie_min(nt) --- > write(6,"('Initial frac1,2,nt-1,nt,amie_dhm =',2f7.2,2i5,4i5)") > | frac1,frac2,nt-1,nt,(amie_dhm(nt-1,i),i=1,2), > | (amie_dhm(nt,j),j=1,2) 1049,1050c1015 < call addfld('PHIHM2D','2D AMIE-TYPE ELECTRIC POTENTIAL','V', < | phihm,'mlon',1,nmlonp1,'mlat',1,nmlat,0) --- >