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 ); |