Use Delphi to write GrADS files and call

Source: Internet
Author: User
Use Delphi to write GrADS files and call the common Linux technology-Linux programming and kernel information in Linux. The following is a detailed description. Task Description: Write the temperature (decoded) of each layer of the high-altitude packets into the dat and ctl files in GrADS format using Delphi, and transmit these files to Linux, when drawing the Arem forecast result in Linux, add the live scene to compare the forecast and the live result.

Difficulty: Use Delphi to write GrADS files

Delphi:
CODE: // write the Dat file (Data format is Single)
StrTemp: = ExtractFileName (strFileName );
Fn: = ExtractFilePath (strFileName) + strTemp + '. dat ';
FnCtl: = ExtractFilePath (strFileName) + strTemp + '. ctl ';
Assignfile (fdat, fn );
Rewrite (fdat, 1 );
For I: = Low (Data) to High (data) do begin
Blockwrite (fdat, Data [I]. T, SizeOf (Data [I]. T ));
End;
Closefile (fdat );

// Write control file
AssignFile (ftxt, fnctl );
Rewrite (ftxt );

Write (ftxt, 'dset ^ '+ ExtractFileName (fn) + chr (10); // If writeln is used directly, an error will occur in Linux.
Write (ftxt, 'title real data' + chr (10 ));
Write (ftxt, 'Options little_endian '+ chr (10 ));
Write (ftxt, 'undef-100' + chr (10 ));
Write (ftxt, 'xdef 1 linear 1 1' + chr (10 ));
Write (ftxt, 'ydef 1 linear 1 1' + chr (10 ));
Write (ftxt, 'zdef '+ inttostr (length (Data) + 'levels' + chr (10 ));
StrTemp: = '';
For I: = 0 to Length (Data)-1 do begin
StrTemp: = strTemp + Floattostr (Data [I]. H) + '';
End;
Write (ftxt, strTemp + chr (10 ));
Write (ftxt, 'tdef 1 linear 12z12JAN2008 1hr' + chr (10 ));
Write (ftxt, 'vars 1' + chr (10 ));
Write (ftxt, 't' + inttostr (length (Data) + '0 Temperature '+ chr (10 ));
Write (ftxt, 'enabless' + chr (10 ));
CloseFile (ftxt );

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.