forked from sandialabs/StrideSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTropicalSearchDriver.f90
107 lines (79 loc) · 4.17 KB
/
TropicalSearchDriver.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
program TropicalSearchDriver
!> @file TropicalSearchDriver.f90
!> @brief Driver program for spatial searches for tropical storms.
!> Demonstrates TropicalStormListNode, TropicalData, and TropicalStrideSearch.
!> @author Peter Bosler, SNL
use TropicalDataModule
use TropicalStormListNodeModule
use TropicalStrideSearchModule
implicit none
character(len = 256) :: ncfilename
character(len = 256) :: namelistfile
character(len = 256) :: outputDir, outputRoot, outputFile, outputFileRoot
real :: southernBoundary, northernBoundary
real :: sectorRadius
real :: pslThreshold, windThreshold, vortThreshold, vortPslDistThreshold, tempPslDistThreshold, tempExcessThreshold
integer :: argc
real :: programTimerStart, programTimerEnd
integer :: readStat
type(TropicalData) :: ncData
integer :: year, month, day, hour, timeIndex
type(TropicalStrideSearchSector) :: tSearch
type(TropicalStormListNode), pointer :: tstormList
namelist /input/ ncfilename, southernBoundary, northernBoundary, sectorRadius, &
pslThreshold, windThreshold, vortThreshold, vortPslDistThreshold, tempPslDistThreshold, &
tempExcessThreshold, outputDir, outputRoot
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! start program : read input from user
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
call cpu_time(programTimerStart)
print *, "Stride Search. Copyright 2016 Sandia Corporation. Under the terms of contract DE-AC04-94AL85000, ", &
"there is a non-exclusive license for use of this work by or on behalf of the U.S. Government. ", &
" Export of this program may require a license from the United States Government."
call GET_COMMAND_ARGUMENT(1, namelistfile)
open(unit=12, file=trim(namelistfile), status='OLD', action='READ', iostat=readStat)
if ( readStat /= 0 ) stop "ERROR: cannot open namelist file"
read(12, nml=input)
print *, "---- reading data from file : ", trim(ncfilename), " -----"
print *, "southernBoundary = ", southernBoundary
print *, "northernBoundary = ", northernBoundary
print *, "sectorRadius = ", sectorRadius
print *, "pslThreshold = ", pslThreshold
print *, "vortThreshold = ", vortThreshold
print *, "windThreshold = ", windThreshold
print *, "vortPslDistThreshold = ", vortPslDistThreshold
print *, "tempExcessThreshold = ", tempExcessThreshold
print *, "tempPslDistThreshold = ", tempPslDistThreshold
close(12)
write(outputFileRoot,'(A,A,A)') trim(outputDir), '/', trim(outputRoot)
write(outputFile,'(A,A)') trim(outputFileRoot), '.txt'
open(unit=14, file=outputFile, status='REPLACE', action='WRITE')
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! initialize search
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
call initializeTropicalData(ncData, ncfilename)
call PrintCoordinateInfo(ncData)
call TropicalSearchSetup( tSearch, southernBoundary, northernBoundary, sectorRadius, &
pslThreshold, vortThreshold, windThreshold, &
vortPslDistThreshold, tempExcessThreshold, tempPslDistThreshold, ncData)
call PrintTropicalSearchInfo( tSearch )
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! search each timestep
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
do timeIndex = 1, ncData%nTimesteps
allocate(tstormList)
if ( mod(timeIndex, 40) == 0 ) &
write(6,'(A,I4,A,I4,A)') "processing time step ", timeIndex, " of ", ncData%nTimesteps, "..."
call ReadTropicalVariablesAtTimestep( ncData, year, month, day, hour, timeIndex )
call DoTropicalSearch( tstormList, tSearch, ncData )
call MarkTropicalNodesForRemoval( tstormList, tSearch, southernBoundary, northernBoundary)
!call ApplyTropicalLandMask( tstormList )
call RemoveMarkedTropicalNodes(tstormList)
!write(6,'(A,I4,A)') " found ", tstormList%listSize, " storms that match the per-timestep spatial criteria."
call PrintTropicalTSTORMSOutput( tstormList, 14, year, month, day, hour )
call deleteTropicalList(tstormList)
enddo
close(14)
call cpu_time(programTimerEnd)
write(6,*) "**** PROGRAM COMPLETE ***** elapsed time = ", (programTimerEnd - programTimerStart), " seconds."
end program