pro checknext,stillhole,lonmin,lonmax,latmin,latmax,centlat,$ lon_min_all,lon_max_all,lat_min_all,$ lat_max_all,legacy_id_all,fhnext_all,fhout,legindex,verbose=verbose,$ dofuncrot=dofuncrot,whichrot=whichrot,$ npadlat=npadlat,npadlonplus=npadlonplus,npadlonminus=npadlonminus ; ; Name: checknext ; ; Purpose: check to see if coronal hole survives to next rotation ; ; Inputs: ; ; stillhole - ; Keeps count of number of incidents ; of a legacy coronal hole. There can be more than one per rotation ; after first rotation, if for example the hole splits into multiple ; coronal holes. Starts out set to 1 ; ; lonmin,lonmax,latmin,latmax - ; limits on latitude and longitude on coronal hole being checked ; ; lon_min_all,lon_max_all,lat_min_all,lat_max_all - ; limits on latitude and longitude on all the coronal holes ; for the next carrington rotation ; ; legacy_id_all- ; filled in program LEGACY with id of each unique coronal hole ; should only be set if a coronal hole has already been identified ; as matching a pre-existing coronal hole ; Only used in this program to double check that it is not set already ; ; fhnext_all - ; indices for all coronal holes for the next carrington rotation ; ; legindex - ; current legacy_id set for fh -- may be overwritten ; if pre existing one is found ; ; centlat -- latitude of centroid of coronal hole being checked ; ; Keyword Inputs (all Defaults set in legacy.pro) ; ; verbose - whether to print stuff ; Default = 0 ; ; npadlat - padding plus and minus for latitude ; -- default 0 degrees ; ; npadlonplus - padding in front of longitude - ; default 0 degrees ; npadlonminus - padding behind longitude - ; default 0 degrees ; note -- these are not used if dofuncrot is set ; ; dofuncrot - if set will take into consideration differential rotation ; in setting up npadlon ; Default = 0 ; ; whichrot -- this chooses differential rotation to use, ; 0-magnetic features, 1- plasma, 2 eventually will be larisza function ; default = 1 ; ; Outputs: ; ; stillhole 0 (no) or nonzero (yes) as to whether the coronal hole survives ; to the next rotation. The numerical value of nonzero implies how many ; it has split into more than one coronal hole in that next rotation. ; ; lonmin, lonmax, latmin, latmax will be changed to encompass ; position[s] of new hole[s] ; ; fhout - ; index of coronal hole for next rotation if it exists ; Can be an array of indices, for coronal holes that exist for more ; than 2 Carrington rotations, and also for coronal holes that ; break into more than one later coronal holes ; ; CALLED by legacy.pro ; CALLS func_rot.pro ; if dofuncrot is set ; ; Changes: ; May 2019: ; made reset latmin/max lonmin/max encompass all new coronal holes that overlap ; changed centlat to input not keyword ; ; ; Written: Ian Hewins, Sarah Gibson ; ; define my box ; ; NOTE we really should not need to add lat/lon ; padding unless we are explicitly doing differential ; rotation which will only occur if we set dofuncrot=1 as below ; so that is why these default to zero. The only reason ; to change via the keywords npadlat, npadlon would be if we wanted to make our ; boxes including coronal holes even more generous. We run the risk ; of overidentifying coronal holes as begin continuations of a previous ; one if we do, though. Also note that npadlonplus,npadlonminus ; will be overwritten if dofuncrot is set. ; ; if verbose eq 1 then print,'CHECKNEXT RUNNING...' if dofuncrot eq 1 then begin lonchange=func_rot(centlat,whichrot=whichrot) npadlonminus=lonchange npadlonplus=-1*lonchange endif latadd=npadlat latsub=npadlat lonadd=npadlonplus lonsub=npadlonminus latminuse=latmin-latsub latmaxuse=latmax+latadd lonminuse=lonmin-lonsub lonmaxuse=lonmax+lonadd if verbose eq 1 then print,'SEARCH WINDOW',latminuse,latmaxuse,lonminuse,lonmaxuse nh=n_elements(fhnext_all) ; ; if hole splits into multiple, will set up box ; encompassing all parts - the updated biggest ; box is initiated here with upper limits ; latmincheck=90. latmaxcheck=-90. lonmincheck=360. lonmaxcheck=0. stillholestart=stillhole ; ; screen for polar coronal holes ; if latmin lt -80. then south = 1 else south = 0 if latmax gt 80. then north = 1 else north = 0 for i = 0,nh-1 do begin if lat_min_all[i] lt -80. then southnew = 1 else southnew = 0 if lat_max_all[i] gt 80. then northnew = 1 else northnew = 0 ; ; case still polar ; if (south eq 1 and southnew eq 1) or (north eq 1 and northnew eq 1) then begin if stillhole eq 1 then fhout=fhnext_all[i] else fhout=[fhout,fhnext_all[i]] stillhole=stillhole+1 ; ; these next shouldn't matter too much because we are ; not using the bounding box but just the fact the coronal holes ; extend above/below +/- 80 in identifying polar holes ; Will compare to current CROT latmin/latmax/lonmin/lonmax ; rather than extrema because then they represent most ; comprehensive size of polar coronal holes. ; latmincheck=min(lat_min_all[i],latmin) latmaxcheck=max(lat_max_all[i],latmax) lonmincheck=min(lon_min_all[i],lonmin) lonmaxcheck=max(lon_max_all[i],lonmax) endif else begin ; ; case not polar for either rotation ; check to see if overlap ; if (south eq 0 and southnew eq 0) and (north eq 0 and northnew eq 0) then begin if (lat_min_all[i] ge latminuse and lat_min_all[i] le latmaxuse)$ or (latminuse ge lat_min_all[i] and latminuse le lat_max_all[i])$ or (lat_max_all[i] ge latminuse and lat_max_all[i] le latmaxuse)$ or (latmaxuse ge lat_min_all[i] and latmaxuse le lat_max_all[i]) then begin if (lon_min_all[i] ge lonminuse and lon_min_all[i] le lonmaxuse)$ or (lonminuse ge lon_min_all[i] and lonminuse le lon_max_all[i])$ or (lon_max_all[i] ge lonminuse and lon_max_all[i] le lonmaxuse)$ or (lonmaxuse ge lon_min_all[i] and lonmaxuse le lon_max_all[i]) then begin if stillhole eq 1 then fhout=fhnext_all[i] else fhout=[fhout,fhnext_all[i]] stillhole=stillhole+1 latmincheck=min(lat_min_all[i],latmincheck) latmaxcheck=max(lat_max_all[i],latmaxcheck) lonmincheck=min(lon_min_all[i],lonmincheck) lonmaxcheck=max(lon_max_all[i],lonmaxcheck) ; latmincheck=lat_min_all[i] ; latmaxcheck=lat_max_all[i] ; lonmincheck=lon_min_all[i] ; lonmaxcheck=lon_max_all[i] if legacy_id_all[i] ne 0 and legacy_id_all[i] ne legindex then begin if verbose eq 1 then begin print,'warning! more than one legacy id identified for a CH' print,legindex,legacy_id_all[i] print,'this can happen if a coronal hole overlaps with preceding CH from different rotations that do not overlap with each other (e.g., merger of coronal holes).' print,'resetting current legacy id to previously set one' endif legindex=legacy_id_all[i] endif endif endif endif endelse endfor ; ; if stillhole has not changed, it means that no hole has been found ; in this next rotation, so needs to be turned off ; ;print,stillhole,stillholestart if stillhole eq stillholestart then begin stillhole=0 endif else begin latmin=latmincheck latmax=latmaxcheck lonmin=lonmincheck lonmax=lonmaxcheck if verbose eq 1 then print,'FOUNDHOLE=',latmin,latmax,lonmin,lonmax endelse ;stop end