Using LibreOffice to generate GrADS binary files

Talk about anything at all....

Using LibreOffice to generate GrADS binary files

Postby Bald Eagle » Sat May 18, 2019 3:00 am

Hi all,

I was wondering if there are any tools in LibreOffice / OpenOffice that can take data (possibly/preferably from a Calc spreadsheet) and write it to a binary file for direct use in GrADS. Thus using the globe as a graphing surface.

http://climserv.ipsl.polytechnique.fr/d ... ddata.html

The data must be written in sequential or direct access / stream format.

Just investigating the feasibility right now, before I invest too much time in doing anything - this is an unpaid hobby application, but I could see people's interest in this if it were possible.

Thanks so much!
OpenOffice 4.1.1 on Windows 7
Bald Eagle
 
Posts: 60
Joined: Wed Apr 19, 2017 9:22 pm

Re: Using LibreOffice to generate GrADS binary files

Postby RusselB » Sat May 18, 2019 3:34 am

A quick check on the details via the link you provided indicates to me that this is not feasible without an extension, and neither the OpenOffice or the LibreOffice extension/template sites had anything that looked correct.
Thus, at this point, I think you're going about this the wrong way, though just what software would be appropriate, I have no idea.
OpenOffice 4.1.6 and LibreOffice 6.0.6.2 on Windows 7 Pro & Ultimate
If you believe your problem has been resolved, please go to your first post in this topic, click the Edit button and add [Solved] to the beginning of the Subject line.
User avatar
RusselB
Moderator
 
Posts: 5390
Joined: Fri Jan 03, 2014 7:31 am
Location: Sarnia, ON

Re: Using LibreOffice to generate GrADS binary files

Postby robleyd » Sat May 18, 2019 3:43 am

Looking at the link you provided, it seems to me that the GrADS file is simply two delimited text files The descriptor file is space separated and the so-called "binary" file is comma separated.

Based on what I see in your link, in both cases, I think you could simply Save As -> .csv a suitably structured Calc file, with the appropriate options for the separator.

If this isn't the case, perhaps you can link to more information?
Cheers
David
Apache OpenOffice Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2930
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Using LibreOffice to generate GrADS binary files

Postby Bald Eagle » Sat May 18, 2019 1:40 pm

Hi David,
Thanks for the reply.

I spent quite a bit more time than I wanted to trying to figure this out a while back, and the GrADS community seems pretty insistent and consistent that there IS a _data descriptor_ file that is blank-delimited text, but the file with the _data_ is, and must be written in binary.

(because only academics make the very first step of the learning curve like going all the way from the floor to the top of a rock-climbing wall)
I once plotted (almost) all of the Minor Planet data (65,000 records) in 3D, and the hardest part - aside from the wacky description of the orbital dynamics components - was unpacking the stupid DATE FORMAT. :roll: :crazy:

So rather than have a tool where you can input user data easily, if you're not using a pre-existing data set, they expect you to have to learn how to program in Fortran or C....
Notice I am annoyed, but undeterred. ;)

In the following link, this person states:
"As you can see there is no format definition for the binary file. This
is the reason wha the variables have to be in the correct form (single
our double precission) to avoid problems."
http://gradsusr.org/pipermail/gradsusr/ ... 30735.html

So I would imagine that the requirement for the specific number format excludes something like variable-length comma-delimited text records.
One also has to define a unique value to assign to missing data, which seems to be consistent with the fact that each entry takes up a certain well-defined "block" in the binary stream - the size of the data entry thus being "self-delimiting".

https://www.atmos.umd.edu/~gcm/usefuldo ... grads.html

So I was thinking maybe people have had occasion in the past to need binary data written from something like Calc, and there might be some macros or something to do that with, or adapt.

Like I said, I was just curious if Libre/Open had the capability to write to binary, as a Calc sheet would be simple, human-readable and editable, and could be used as a fairly quick and simple template to create custom data sets and start test-driving GrADS, rather than having to build the "car" from hand-machined parts.

Thanks again.
OpenOffice 4.1.1 on Windows 7
Bald Eagle
 
Posts: 60
Joined: Wed Apr 19, 2017 9:22 pm

Re: Using LibreOffice to generate GrADS binary files

Postby robleyd » Sat May 18, 2019 2:08 pm

I found a sample Grads data file, and it is in fact more complex than a simple text file. So the answer to your question is probably No.
Cheers
David
Apache OpenOffice Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2930
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Using LibreOffice to generate GrADS binary files

Postby MrProgrammer » Sat May 18, 2019 5:51 pm

Bald Eagle wrote:I was wondering if [I] can take data … and write it to a binary file for direct use in GrADS.
Of course you can create binary files from Calc. The UNICHAR function can create any arbitrary bytes you want. Using formulas you can create any desired sequence of bytes in column A of a sheet. Exporting that sheet as CSV creates a file with any desired sequence of bytes.

There are some significant difficulties however. You must determine what byte sequence is needed for GrADS binary files. Then you must determine which formulas will produce those bytes. Integer representations will probably be easy, for example the low byte for an integer: UNICHAR(MOD(cell;256)). Floating-point numbers are more work. If you need IEEE-754 single precision for REAL*4, this Wikipedia article explaines the byte sequence for that format. The formulas won't be simple however. For example, cell<0 gives the sign and INT(LOG(ABS(cell);2)) gives the exponent. Part of the exponent is combined with the sign to form one byte: UNICHAR(IF(sign;128;0)+QUOTIENT(exponent+127;2)).

It may be a lot less work to learn enough Fortran to create the files using the standard GrADS documentation.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.5 Build 9789 on MacOS 10.11.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3808
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Using LibreOffice to generate GrADS binary files

Postby RoryOF » Sat May 18, 2019 6:24 pm

MrProgrammer wrote:It may be a lot less work to learn enough Fortran to create the files using the standard GrADS documentation.


Bearing in mind that I started to program in Fortran II in 1965 and took to BASIC instinctively as a result, BASIC might be quite sufficient.
Apache OpenOffice 4.1.6 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29430
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 6 guests