Automate reading of files using conread

Topics about the HYSPLIT dispersion model.
Post Reply
jacobkh
Posts: 3
Joined: July 21st, 2017, 9:38 pm
Registered HYSPLIT User: No

Automate reading of files using conread

Post by jacobkh » July 21st, 2017, 10:21 pm

Thanks for all your work on HYSPLIT.

I am trying to write my own scripts (in MATLAB) to run HYSPLIT and analyze the results. However, I am having trouble reading in the binary files. I have the PC version of HYSPLIT (Windows, Feb 2016, svn:802). The executable conread would work, except it requires user inputs (filename, Extended diagnostics (0/1), Enter) after it has started, which makes it difficult to put in a script. Is there some way to use conread with just 1 command line, similar to con2asc? I would prefer not to have to convert to another format if possible.

jacobkh
Posts: 3
Joined: July 21st, 2017, 9:38 pm
Registered HYSPLIT User: No

Re: Automate reading of files using conread

Post by jacobkh » July 27th, 2017, 11:26 pm

It turns out the source code for this executable is already included in the downloadable version of HYSPLIT (data2arl/utilities/conread.f). Looking at the code, there is no option natively to include all the input arguments on one line. However, I was able to solve this myself by modifying the code to accept the filename and turn on/off "Extended diagnostics" from a single line. Now I can read the binary files into MATLAB without any direct intervention (with MATLAB's "system" command).

I compiled conread.f using gfortran after some format modifications. Also to anyone else who may attempt their own modifications, you may need to explicitly specify CONVERT='BIG_ENDIAN' as an argument when opening the file (line 87 in the original).

I've attached my version (note it's actually a fortran source code file and you may need to change the extension if you use it). After compiling you can run using the "-h" argument to see help.
Attachments
conread_f.txt
NOTE: Actually a FORTRAN source code file, change the extension as appropriate and compile.
(12.18 KiB) Downloaded 70 times

prabalroy
Posts: 5
Joined: June 6th, 2017, 9:49 am
Registered HYSPLIT User: Yes

conread.txt

Post by prabalroy » June 13th, 2018, 5:09 pm

Conread.txt file is automatically getting bigger (while working on Hysplit) on my working directory and already took 84 GB. Can I delete this file or clean up ? :?: :?: :?:

glenn.rolph
Posts: 324
Joined: November 7th, 2012, 1:39 pm
Registered HYSPLIT User: Yes
Contact:

Re: Automate reading of files using conread

Post by glenn.rolph » June 14th, 2018, 6:34 am

conread.txt is created whenever you use the "Simple Listing" program of the GUI to look at the contents of a binary concentration file. It is a text file and can be opened to read it, however if you no longer need it, delete it.

Post Reply