Skip to content

Commit a0335e8

Browse files
authored
Merge pull request dtarb#95 from dtarb/94-gagewatershed-fix
Fix for gagewatershed
2 parents 8c02418 + bf49591 commit a0335e8

File tree

3 files changed

+87
-89
lines changed

3 files changed

+87
-89
lines changed

WindowsInstaller/Firewall.bat

-31
This file was deleted.

WindowsInstaller/setup.iss

+79-54
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
; **** REQUIREMENTS FOR COMPILING THIS INSTALLER SCRIPT ****
66
; The following files must exist in the directory defined by the SourceDir paramter under the [Setup] section below:
7-
; GDAL-1.9.2.win32-py2.7.exe (Python GDAL)
8-
; gdal-111-1600-core.msi (C++ GDAL)
9-
; gdal-111-1600-x64-core.msi (C++ GDAL)
10-
; mpi_x86.msi
11-
; mpi_x64.msi
12-
; vcredist_x86_2010.exe
13-
; vcredist_x64_2010.exe
14-
; Firewall.bat
7+
; GDAL-2.1.0.win32-py2.7.msi (Python GDAL)
8+
; gdal-201-1800-core.msi (C++ GDAL for x86)
9+
; gdal-201-1800-x64-core.msi (C++ GDAL for x64)
10+
; msmpisdk.msi (Microsoft MPI v7.1)
11+
; MSMpiSetup.exe (Microsoft MPI v7.1)
12+
; vcredist_x86_2010.exe (Micosoft C++ 2010 x86 redistributable)
13+
; vcredist_x64_2010.exe (Micosoft C++ 2010 x64 redistributable);
1514
; GDAL 32-bit library files must exist under the following directory (this directory should exists under the dir defined by SourceDir parameter):
1615
; GDAL_32/
1716
; GDAL 64-bit library files must exist under the following directory (this directory should exists under the dir defined by SourceDir parameter):
@@ -26,12 +25,11 @@
2625
; *** SOURCE CONTROL REQUIREMENTS ****
2726
; All the files (as listed below) under the WindowsInstaller folder are included in source control
2827
; This script file (setup.ino).
29-
; Firewall.bat - Any time this file is updated it should be copied to the dir specified by the SoureDir param in the [Setup] section of this script
3028
; taudem.bmp - Any time this file is updated it should be copied to the dir specified by the SoureDir param in the [Setup] section of this script
3129

3230

3331
#define MyAppName "TauDEM"
34-
#define MyAppVersion "5.3.6"
32+
#define MyAppVersion "5.3.7"
3533
#define MyAppPublisher "Utah State University"
3634
#define MyAppURL "http://hydrology.usu.edu/taudem/taudem5/index.html"
3735

@@ -75,16 +73,16 @@ Name: "C:\GDAL"
7573

7674
[Files]
7775
; copy files
78-
Source: "GDAL-1.9.2.win32-py2.7.exe"; DestDir: "{app}\setup_files"; Flags: ignoreversion
79-
Source: "gdal-111-1600-core.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion; Check: not Is64BitInstallMode
80-
Source: "gdal-111-1600-x64-core.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion; Check: Is64BitInstallMode
76+
Source: "GDAL-2.1.0.win32-py2.7.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion
77+
Source: "gdal-201-1800-core.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion; Check: not Is64BitInstallMode
78+
Source: "gdal-201-1800-x64-core.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion; Check: Is64BitInstallMode
8179

82-
Source: "mpi_x86.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion; Check: not Is64BitInstallMode
83-
Source: "mpi_x64.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion; Check: Is64BitInstallMode
80+
Source: "msmpisdk.msi"; DestDir: "{app}\setup_files"; Flags: ignoreversion
81+
Source: "MSMpiSetup.exe"; DestDir: "{app}\setup_files"; Flags: ignoreversion
8482

8583
; since for 64bit installtion we need both x86 and x64 redestributables no need to check OS architecture for copying files
86-
Source: "vcredist_x86_2010.exe"; DestDir: "{app}\setup_files"; Flags: ignoreversion
87-
Source: "vcredist_x64_2010.exe"; DestDir: "{app}\setup_files"; Flags: ignoreversion
84+
Source: "vc_redist.x86_2015.exe"; DestDir: "{app}\setup_files"; Flags: ignoreversion
85+
Source: "vc_redist.x64_2015.exe"; DestDir: "{app}\setup_files"; Flags: ignoreversion
8886

8987
Source: "GDAL_64\*"; DestDir: "C:\GDAL"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: Is64BitInstallMode
9088
Source: "GDAL_32\*"; DestDir: "C:\GDAL"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: not Is64BitInstallMode
@@ -94,21 +92,19 @@ Source: "TauDEM_Exe\win_64\*"; DestDir: "{app}\TauDEM5Exe"; Flags: ignoreversion
9492

9593
Source: "TauDEMArcGIS\*"; DestDir: "{app}\TauDEM5Arc"; Flags: ignoreversion recursesubdirs createallsubdirs
9694

97-
Source: "Firewall.bat"; DestDir: "{app}\setup_files"; Flags: ignoreversion
9895
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
9996

10097
[Run]
10198
; install GDAL core components
102-
Filename: "{app}\setup_files\GDAL-1.9.2.win32-py2.7.exe"; Flags: waituntilterminated shellexec
103-
Filename: "{app}\setup_files\gdal-111-1600-core.msi"; Flags: waituntilterminated shellexec; Check: not Is64BitInstallMode
104-
Filename: "{app}\setup_files\gdal-111-1600-x64-core.msi"; Flags: waituntilterminated shellexec; Check: Is64BitInstallMode
99+
; TODO: Implement functions to check if GDAL needs to be installed (all got the registry keys for all these 3 installations)
100+
Filename: "{app}\setup_files\GDAL-2.1.0.win32-py2.7.msi"; Flags: waituntilterminated shellexec; Check: NeedsToInstallGDAL_PY()
101+
Filename: "{app}\setup_files\gdal-201-1800-core.msi"; Flags: waituntilterminated shellexec; Check: NeedsToInstallGDAL_C(False)
102+
Filename: "{app}\setup_files\gdal-201-1800-x64-core.msi"; Flags: waituntilterminated shellexec; Check: NeedsToInstallGDAL_C(True)
105103

106-
Filename: "{app}\setup_files\vcredist_x86_2010.exe"; Flags: waituntilterminated; Check: NeedsToInstallRedist(False)
107-
Filename: "{app}\setup_files\vcredist_x64_2010.exe"; Flags: waituntilterminated; Check: NeedsToInstallRedist(True)
104+
Filename: "{app}\setup_files\vc_redist.x86_2015.exe"; Flags: waituntilterminated; Check: NeedsToInstallRedist(False)
105+
Filename: "{app}\setup_files\vc_redist.x64_2015.exe"; Flags: waituntilterminated; Check: NeedsToInstallRedist(True)
108106

109-
Filename: "{app}\setup_files\mpi_x86.msi"; Flags: waituntilterminated shellexec; Check: NeedsToInstallMPI(False)
110-
Filename: "{app}\setup_files\mpi_x64.msi"; Flags: waituntilterminated shellexec; Check: NeedsToInstallMPI(True)
111-
Filename: "{app}\setup_files\Firewall.bat"; Flags: waituntilterminated shellexec; AfterInstall: CleanUp('{app}\setup_files')
107+
Filename: "{app}\setup_files\MSMpiSetup.exe"; Flags: waituntilterminated shellexec; Check: NeedsToInstallMPI()
112108

113109

114110
[Registry]
@@ -139,21 +135,21 @@ begin
139135
'3. When prompted to Choose Setup Type for GDAL, choose "Typical".'#13 +
140136
'4. The installer will also add firewall exceptions to allow TauDEM programs to run. These allow MPI interprocess communication used in the parallel computations. This is communication within your computer and not over any external network.'#13 +
141137
'5. The installer will also add the following path entries:' +
142-
'C:\Program Files\Microsoft HPC Pack 2012\Bin\;C:\GDAL;C:\Program Files\GDAL;C:\Program Files\TauDEM\TauDEM5Exe';
138+
'C:\Program Files\Microsoft MPI\Bin\;C:\GDAL;C:\Program Files\GDAL;C:\Program Files\TauDEM\TauDEM5Exe';
143139
144140
if Is64BitInstallMode then
145141
begin
146142
UserPage := CreateInputQueryPage(wpWelcome,
147143
'The following programs will be installed', '',
148-
'TauDEM version 5.3.5, GDAL 1.9.2 (Python 2.7), GDAL 111 (MSVC 2010) for 64 bit Winodws PC, Microsoft Visual C++ 2010 SP1 Redistributable Package (x86), ' +
149-
'Microsoft Visual C++ 2010 SP1 Redistributable Package (x64), Microsoft HPC Pack 2012 MS-MPI Redistributable Package'#13#13 + notes_string);
144+
'TauDEM version 5.3.7, GDAL 2.1.0 (Python 2.7), GDAL 201 (MSVC 2013) for 64 bit Windows PC, Microsoft Visual C++ 2015 Redistributable Package (x86), ' +
145+
'Microsoft Visual C++ 2015 Redistributable Package (x64), Microsoft MPI'#13#13 + notes_string);
150146
end
151147
else
152148
begin
153149
UserPage := CreateInputQueryPage(wpWelcome,
154150
'The following programs will be installed', '',
155-
'TauDEM version 5.3.5, GDAL 1.9.2 (Python 2.7), GDAL 111 (MSVC 2010) for 32 bit Windows PC, Microsoft Visual C++ 2010 SP1 Redistributable Package (x86), ' +
156-
'Microsoft HPC Pack 2012 MS-MPI Redistributable Package'#13#13 + notes_string);
151+
'TauDEM version 5.3.7, GDAL 2.1.0 (Python 2.7), GDAL 201 (MSVC 2013) for 32 bit Windows PC, Microsoft Visual C++ 2015 Redistributable Package (x86), ' +
152+
'Microsoft MPI'#13#13 + notes_string);
157153
end
158154
end;
159155
@@ -162,8 +158,8 @@ end;
162158
function NeedsToInstallRedist(IsInstallAppX64: boolean): boolean;
163159
begin
164160
if Is64BitInstallMode and IsInstallAppX64 then
165-
begin
166-
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\1926E8D15D0BCE53481466615F760A7F') then
161+
begin
162+
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x64') then
167163
begin
168164
Result := False;
169165
exit;
@@ -174,9 +170,9 @@ begin
174170
exit;
175171
end;
176172
end
177-
else if Is64BitInstallMode and not IsInstallAppX64 then
178-
begin
179-
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\1D5E3C0FEDA1E123187686FED06E995A') then
173+
else if not Is64BitInstallMode and not IsInstallAppX64 then
174+
begin
175+
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\VisualStudio\14.0\VC\Runtimes\x86') then
180176
begin
181177
Result := False;
182178
exit;
@@ -189,26 +185,50 @@ begin
189185
end
190186
else
191187
begin
192-
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\1D5E3C0FEDA1E123187686FED06E995A') then
193-
begin
194-
Result := False;
195-
exit;
196-
end
197-
else
198-
begin
199-
Result := True;
200-
exit;
201-
end;
202-
end;
188+
Result := False;
189+
exit;
190+
end;
203191
end;
204192
205193
// Check if we need to install MPI
206-
// If either a 64 or 32 bit version of MPI is already installed, then this function returns False, otherwise True
207-
function NeedsToInstallMPI(IsInstallAppX64: boolean): boolean;
194+
// If MPI is already installed, then this function returns False, otherwise True
195+
function NeedsToInstallMPI(): boolean;
196+
begin
197+
198+
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\WOW6432Node\Microsoft\MPI') then
199+
begin
200+
Result := False;
201+
exit;
202+
end
203+
else
204+
begin
205+
Result := True;
206+
exit;
207+
end;
208+
end;
209+
210+
function NeedsToInstallGDAL_PY(): boolean;
211+
// check if we need to install GDAL Python module
212+
begin
213+
214+
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\7DB0C91EA9BCA914AAD09A56B9B9A75B') then
215+
begin
216+
Result := False;
217+
exit;
218+
end
219+
else
220+
begin
221+
Result := True;
222+
exit;
223+
end;
224+
end;
225+
226+
function NeedsToInstallGDAL_C(IsInstallAppX64: boolean): boolean;
227+
// checks if we need to install GDAL C++ library
208228
begin
209229
if Is64BitInstallMode and IsInstallAppX64 then
210-
begin
211-
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\618A082FBC0C00743A6CF9DDC808DF81') then
230+
begin
231+
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\7E174159D1F9EFC4AA53953383A125AA') then
212232
begin
213233
Result := False;
214234
exit;
@@ -220,8 +240,8 @@ begin
220240
end;
221241
end
222242
else if not Is64BitInstallMode and not IsInstallAppX64 then
223-
begin
224-
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\2B417A095389B814BBF02657C04C242B') then
243+
begin
244+
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\Installer\Products\81785C15296278C4EB911F279D9961F5') then
225245
begin
226246
Result := False;
227247
exit;
@@ -231,7 +251,12 @@ begin
231251
Result := True;
232252
exit;
233253
end;
234-
end;
254+
end
255+
else
256+
begin
257+
Result := False;
258+
exit;
259+
end;
235260
end;
236261
237262
function NeedsAddPath(NewPath: string; Win64: boolean; CheckOSArchitecture: boolean): boolean;

src/gagewatershed.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ int gagewatershed( char *pfile,char *wfile, char* datasrc,char* lyrname,int usel
6969
int *dsids=NULL;
7070
int idnodata;
7171
FILE *fidout1;
72-
fidout1 = fopen(upidfile,"a");
72+
if (writeupid == 1) {
73+
fidout1 = fopen(upidfile, "a");
74+
}
75+
7376
double begint = MPI_Wtime();
7477
tiffIO p(pfile,SHORT_TYPE);
7578
long totalX = p.getTotalX();
@@ -231,13 +234,14 @@ int gagewatershed( char *pfile,char *wfile, char* datasrc,char* lyrname,int usel
231234
/* test if neighbor drains towards cell excluding boundaries */
232235
short sdir = flowData->getData(in,jn,tempShort);
233236

234-
if(flowData->isNodata(in,jn)) {
237+
if(flowData->isNodata(in,jn) && writeupid == 1) {
235238
double mx,my;
236239
int gx,gy; // Global x and y (col and row) coordinates
237240
flowData->localToGlobal(in,jn,gx,gy);
238241
p.globalXYToGeo(gx,gy,mx,my);
239-
fprintf(fidout1,"%f, %f\n",mx,my);
240-
fflush(fidout1);
242+
fprintf(fidout1, "%f, %f\n", mx, my);
243+
fflush(fidout1);
244+
241245
//myfile<<mx<<","<<my<<endl;
242246
}
243247
if(sdir > 0)

0 commit comments

Comments
 (0)