[Dhsvm-users] Converting binary to ascii In DHSVM

Bowling, Laura C bowling at purdue.edu
Mon Feb 28 12:49:06 PST 2005


All of the maps should be in one image file.  The total number of rows
will be the number of rows in your dem * the total number of output
maps.

--
Laura C. Bowling
Assistant Professor
Department of Agronomy

Purdue University                     phone: (765) 494-8051    
915 W. State St.                      fax: (765) 496-2926
West Lafayette, IN 47907-2054         bowling at purdue.edu


-----Original Message-----
From: dhsvm-users-bounces at mailman1.u.washington.edu
[mailto:dhsvm-users-bounces at mailman1.u.washington.edu] On Behalf Of
Piotr Kuras
Sent: Monday, February 28, 2005 12:21 PM
To: User Support list for DHSVM Model
Cc: Younes Alila
Subject: RE: [Dhsvm-users] Converting binary to ascii In DHSVM

Thank you Dr. Bowling, I also later determined that the travel time was
not available by trial and error.  I guess I will have to try using the
maps to output the variables (water table and SWE), because I would like
to produce maps at an hourly time step during the peak period of a
particular freshet.  For some reason the image output variable produces
only one output file in binary format, even though I specify that I
would like one for each hour.  Your help is much appreciated,

Regards,

Piotr Kuras


-----Original Message-----

> Date: Mon Feb 28 06:55:50 PST 2005
> From: "Bowling, Laura C" <bowling at purdue.edu>
> Subject: RE: [Dhsvm-users] Converting binary to ascii In DHSVM
> To: "User Support list for DHSVM Model" <dhsvm-users at u.washington.edu>
>
> I think your problem is trying to output the travel time file.  There
> are two problems with this:  1) the travel time file is an input file
to
> DHSVM if you are using the unit hydrograph method of routing.  If you
> have not created this file, the model cannot do it for you; 2) the
> website was out of date regarding which map variable ids can currently
> be output, I have just updated the variable id list on the website.
If
> your favorite variable is not on the list, it doesn't mean that it
> cannot be output, just that you might need to do some editing of the
> DumpMap() in ExecDump.c in order to do it :)
> 
> I would also like to point out that since you are outputting IMAGES
not
> MAPS the output values will be re-scaled to conserve space.  That is,
> after you convert your swq from binary to ascii, the value will not be
> swq in meters, but rather (swq-offset)/range * MAXUCHAR.  If you do
not
> want to deal with this conversion, output MAP variables instead.
> 
> Finally, a note on how I located your problem for future reference:
> 
> * I searched ReportError.c for "Invalid variable ID in", to determine
> the error code associated with this error message.  It was '26'.
> * I searched the source code to find which file contains the DumpMap
> function.  In unix you can use grep: grep 'DumpMap' *.c  It is in the
> ExecDump.c file.
> * I opened ExecDump.c and found the DumpMap function and searched for
> the occurrence of ReportError(*, 26) to determine when this error
could
> be generated.
> * Since this function is using a case block to sort through each
> variable id, I looked for each variable you were attempting to output
> and determined that 'case 006' doesn't exist.
> --
> Laura C. Bowling
> Assistant Professor
> Department of Agronomy
> 
> Purdue University                     phone: (765) 494-8051    
> 915 W. State St.                      fax: (765) 496-2926
> West Lafayette, IN 47907-2054         bowling at purdue.edu
> 
> 
> -----Original Message-----
> From: dhsvm-users-bounces at mailman1.u.washington.edu
> [mailto:dhsvm-users-bounces at mailman1.u.washington.edu] On Behalf Of
> Piotr Kuras
> Sent: Sunday, February 27, 2005 3:35 PM
> To: User Support list for DHSVM Model
> Subject: RE: [Dhsvm-users] Converting binary to ascii In DHSVM
> 
> Thank you Dr. Bowling,
> 
> But it seems that I spoke too soon when I said I had already created
the
> image output files...had the model running while trying to figure out
> the conversion of binary to ascii...I had an error message come up
when
> the model got to the particular time period that I specified, not sure
> if I am missing something in the files (a definition of the variables
> perhaps) or if I simply queried incorrectly.  I got the variable id's
> from the DHSVM website.  If you could please help that would be great.
> 
> The message that comes up is "Invalid variable ID in: DumpMap
> 
> Here is the excerpt from the DHSVM Master file regarding the optional
> ouput.  Perhaps if you could spare the time, you good see if I have
> typed something incorrectly.  thank you
> 
> ########## Model Maps ###############################################
> 
> Number of Map Variables =  0 
> 
> ########## Model Images
###############################################
> 
> # Number of Image Variables =  3
> # 503, 006, 404 
> 
> Number of Image Variables  =  3           # Number of variables for
> which you 
>                                           # would like to output
images
> 
> # For each of the variables make a block like the one that follows,
> varying
> # the number of the variable (n = 1, .. , Number of Image Variables)
> 
> Image Variable        1 =    006             # ID of the variable to
> output
> Image Layer           1 =                 # If the variable exists for
a
> number
> 					  # of layers, specify the
> layers here
> 					  # with the top layer = 1
> Image Start           1 =    05/08/2029-0             # First timestep
> for which to output
>                                           # an image
> Image End             1 =    05/12/2029-23             # Last timestep
> for which to output
>                                           # an image
> Image Interval        1 =    1            # Time interval between
images
> (hours)
> Image Upper Limit     1 =    48             # All values in the output
> equal to or
>                                           # greater than this limit
will
> be set 
>                                           # to 255
> Image Lower Limit     1 =    0             # All values in the output
> equal to or
>                                           # smaller than this limit
will
> be set 
>                                           # to 0
> Image Variable        2 =    404             # ID of the variable to
> output
> Image Layer           2 =                 # If the variable exists for
a
> number
> 					  # of layers, specify the
> layers here
> 					  # with the top layer = 1
> Image Start           2 =    05/08/2029-0             # First timestep
> for which to output
>                                           # an image
> Image End             2 =    05/12/2029-23             # Last timestep
> for which to output
>                                           # an image
> Image Interval        2 =    1            # Time interval between
images
> (hours)
> Image Upper Limit     2 =    0.5             # All values in the
output
> equal to or
>                                           # greater than this limit
will
> be set 
>                                           # to 255
> Image Lower Limit     2 =    0             # All values in the output
> equal to or
>                                           # smaller than this limit
will
> be set 
>                                           # to 0
> Image Variable        3 =    503             # ID of the variable to
> output
> Image Layer           3 =                 # If the variable exists for
a
> number
> 					  # of layers, specify the
> layers here
> 					  # with the top layer = 1
> Image Start           3 =    05/08/2029-0             # First timestep
> for which to output
>                                           # an image
> Image End             3 =    05/12/2029-23             # Last timestep
> for which to output
>                                           # an image
> Image Interval        3 =    1            # Time interval between
images
> (hours)
> Image Upper Limit     3 =    4             # All values in the output
> equal to or
>                                           # greater than this limit
will
> be set 
>                                           # to 255
> Image Lower Limit     3 =    0             # All values in the output
> equal to or
>                                           # smaller than this limit
will
> be set 
>                                           # to 0
> ########## Graphic Images
#############################################
> 
> Number of Graphics =  0 
> 
> 
> 
> 
> 
> -----Original Message-----
> 
> > Date: Sun Feb 27 12:20:12 PST 2005
> > From: "Bowling, Laura C" <bowling at purdue.edu>
> > Subject: RE: [Dhsvm-users] Converting binary to ascii In DHSVM
> > To: "User Support list for DHSVM Model"
<dhsvm-users at u.washington.edu>
> >
> > Yes you can use the same command to go from the binary output file
to
> an
> > ascii file.  You will have to check on the website to determine the
> form
> > of the binary file for each variable output.  For example, water
table
> > depth should be a grid of floats, so the command would be:
> > 
> > convert float ascii outfile.bin outfile.asc #rows #columns
> > 
> > -----Original Message-----
> > From: dhsvm-users-bounces at mailman1.u.washington.edu
> > [mailto:dhsvm-users-bounces at mailman1.u.washington.edu] On Behalf Of
> > Piotr Kuras
> > Sent: Saturday, February 26, 2005 4:15 PM
> > To: dhsvm-users at u.washington.edu
> > Cc: Younes Alila
> > Subject: [Dhsvm-users] Converting binary to ascii In DHSVM
> > 
> > Hello,
> > 
> > I have generated three optional output files (images) in DHSVM which
> > display the water table depth, travel time and snow water
equivalent.
> > The files are in .bin format, and I would like to convert them to
> ascii
> > so I can display them in GIS.
> > 
> > For converting ascii to binary, I have been using the convert.exe
> > application from DHSVM using a ms-dos batch file.  In the ms-dos
batch
> > file I would normally write the command:
> > 
> > convert ascii uchar input_file.asc out_file.bin #rows #columns
> > 
> > I'm not sure if I can convert the other way (binary to ascii using
the
> > same convert.exe file) and if I can does anyone know what command to
> > use? or does someone have a different application for this purpose.
> > 
> > Your help would be much appreciated, thank you,
> > 
> > Pete Kuras
> > --
> > Piotr Kuras
> > M.A.Sc. Candidate
> > Department of Forest Resources Management
> > University of British Columbia
> > 2424 Main Mall
> > Vancouver, BC V6T-1Z4
> > Canada
> > Cell: 778-883-8538
> > E-mail: kuras at interchange.ubc.ca
> > 
> > _______________________________________________
> > Dhsvm-users mailing list
> > Dhsvm-users at u.washington.edu
> > http://mailman1.u.washington.edu/mailman/listinfo/dhsvm-users
> > _______________________________________________
> > Dhsvm-users mailing list
> > Dhsvm-users at u.washington.edu
> > http://mailman1.u.washington.edu/mailman/listinfo/dhsvm-users
> 
> 
> 
> --
> Piotr Kuras
> M.A.Sc. Candidate
> Department of Forest Resources Management
> University of British Columbia
> 2424 Main Mall
> Vancouver, BC V6T-1Z4
> Canada
> Cell: 778-883-8538
> E-mail: kuras at interchange.ubc.ca
> 
> _______________________________________________
> Dhsvm-users mailing list
> Dhsvm-users at u.washington.edu
> http://mailman1.u.washington.edu/mailman/listinfo/dhsvm-users
> _______________________________________________
> Dhsvm-users mailing list
> Dhsvm-users at u.washington.edu
> http://mailman1.u.washington.edu/mailman/listinfo/dhsvm-users



--
Piotr Kuras
M.A.Sc. Candidate
Department of Forest Resources Management
University of British Columbia
2424 Main Mall
Vancouver, BC V6T-1Z4
Canada
Cell: 778-883-8538
E-mail: kuras at interchange.ubc.ca

_______________________________________________
Dhsvm-users mailing list
Dhsvm-users at u.washington.edu
http://mailman1.u.washington.edu/mailman/listinfo/dhsvm-users


More information about the Dhsvm-users mailing list