Skip to content

Commit

Permalink
Merge pull request #52 from dtarb/49-correct-bigtiff-support
Browse files Browse the repository at this point in the history
49 correct bigtiff support
  • Loading branch information
dtarb committed Mar 14, 2016
2 parents 268d8a3 + 56bd56a commit 08a2e33
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Taudem5PCVS2010/TauDEM.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,3,3,0
PRODUCTVERSION 5,3,3,0
FILEVERSION 5,3,4,0
PRODUCTVERSION 5,3,4,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -68,11 +68,11 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "TauDEM Application"
VALUE "FileVersion", "5.3.3.0"
VALUE "FileVersion", "5.3.4.0"
VALUE "InternalName", "TauDEM 5"
VALUE "LegalCopyright", "Copyright (C) 2016 GPL V3"
VALUE "ProductName", "TauDEM"
VALUE "ProductVersion", "5.3.3.0"
VALUE "ProductVersion", "5.3.4.0"
END
END
BLOCK "VarFileInfo"
Expand Down
6 changes: 3 additions & 3 deletions WindowsInstaller/setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
; TauDEMArcGIS/

#define MyAppName "TauDEM"
#define MyAppVersion "5.3.3"
#define MyAppVersion "5.3.4"
#define MyAppPublisher "Utah State University"
#define MyAppURL "http://hydrology.usu.edu/taudem/taudem5/index.html"

Expand Down Expand Up @@ -136,14 +136,14 @@ begin
begin
UserPage := CreateInputQueryPage(wpWelcome,
'The following programs will be installed', '',
'TauDEM version 5.3.3, GDAL 1.9.2 (Python 2.7), GDAL 111 (MSVC 2010) for 64 bit Winodws PC, Microsoft Visual C++ 2010 SP1 Redistributable Package (x86), ' +
'TauDEM version 5.3.4, GDAL 1.9.2 (Python 2.7), GDAL 111 (MSVC 2010) for 64 bit Winodws PC, Microsoft Visual C++ 2010 SP1 Redistributable Package (x86), ' +
'Microsoft Visual C++ 2010 SP1 Redistributable Package (x64), Microsoft HPC Pack 2012 MS-MPI Redistributable Package'#13#13 + notes_string);
end
else
begin
UserPage := CreateInputQueryPage(wpWelcome,
'The following programs will be installed', '',
'TauDEM version 5.3.3, GDAL 1.9.2 (Python 2.7), GDAL 111 (MSVC 2010) for 32 bit Windows PC, Microsoft Visual C++ 2010 SP1 Redistributable Package (x86), ' +
'TauDEM version 5.3.4, GDAL 1.9.2 (Python 2.7), GDAL 111 (MSVC 2010) for 32 bit Windows PC, Microsoft Visual C++ 2010 SP1 Redistributable Package (x86), ' +
'Microsoft HPC Pack 2012 MS-MPI Redistributable Package'#13#13 + notes_string);
end
end;
Expand Down
2 changes: 1 addition & 1 deletion src/commonLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ email: [email protected]
#define NOTFINISHED 0
#define FINISHED 1

#define TDVERSION "5.3.3"
#define TDVERSION "5.3.4"

enum DATA_TYPE
{ SHORT_TYPE,
Expand Down
40 changes: 28 additions & 12 deletions src/tiffIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,10 @@ void tiffIO::write(long xstart, long ystart, long numRows, long numCols, void* s
fflush(stdout);
char **papszMetadata;
char **papszOptions = NULL;
const char *extension_list[5] = {".tif",".img",".sdat",".bil",".bin"}; // extension list --can add more
const char *driver_code[5] = {"GTiff","HFA","SAGA","EHdr","ENVI"}; // code list -- can add more
const char *compression_meth[5] = {"LZW","RLE"," "," "," "}; // code list -- can add more
size_t extension_num=5;
const char *extension_list[6] = {".tif",".img",".sdat",".bil",".bin",".tiff"}; // extension list --can add more
const char *driver_code[6] = {"GTiff","HFA","SAGA","EHdr","ENVI","GTiff"}; // code list -- can add more
const char *compression_meth[6] = {"LZW","YES"," "," "," "," "}; // code list -- can add more
size_t extension_num=6;
char *ext;
int index = -1;

Expand Down Expand Up @@ -293,20 +293,36 @@ void tiffIO::write(long xstart, long ystart, long numRows, long numCols, void* s
if (rank == 0) {
//if (isFileInititialized == 0) {
hDriver = GDALGetDriverByName(driver_code[index]);
papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", compression_meth[index]); //

if (hDriver == NULL) {
printf("driver is not available\n");
MPI_Abort(MPI_COMM_WORLD, 22);
}
// Set options
if(index==0){ // for .tif files. Refer to http://www.gdal.org/frmt_gtiff.html for GTiff options.
papszOptions = CSLSetNameValue( papszOptions, "COMPRESS", compression_meth[index]);
}
else if(index==1){ // .img files. Refer to http://www.gdal.org/frmt_hfa.html where COMPRESSED = YES are create options for ERDAS .img files
papszOptions = CSLSetNameValue( papszOptions, "COMPRESSED", compression_meth[index]);
}
int cellbytes=4;
if (datatype == SHORT_TYPE)cellbytes=2;
double fileGB=(double)cellbytes*(double)totalX*(double)totalY/1000000000.0; // This purposely neglects the lower significant digits to overvalue GB to allow space for header information in the file
if(fileGB > 4.0){
if(index==0 || index==6){ // .tiff files. Need to explicity indicate BIGTIFF. See http://www.gdal.org/frmt_gtiff.html.
papszOptions = CSLSetNameValue( papszOptions, "BIGTIFF", "YES");
printf("Setting BIGTIFF, File: %s, Anticipated size (GB):%.2f\n", filename,fileGB);
}
}

GDALDataType eBDataType;
if (datatype == FLOAT_TYPE)
eBDataType = GDT_Float32;
else if (datatype == SHORT_TYPE)
eBDataType = GDT_Int16;
else if (datatype == LONG_TYPE)
eBDataType = GDT_Int32;
if (datatype == FLOAT_TYPE)
eBDataType = GDT_Float32;
else if (datatype == SHORT_TYPE)
{
eBDataType = GDT_Int16;
}
else if (datatype == LONG_TYPE)
eBDataType = GDT_Int32;


fh = GDALCreate(hDriver, filename, totalX , totalY, 1, eBDataType, papszOptions);
Expand Down

0 comments on commit 08a2e33

Please sign in to comment.