OpenCPN Partial API docs
Loading...
Searching...
No Matches
GRIBFile Class Reference

Manages multiple GRIB record sets from one or more GRIB files. More...

#include <GribUIDialog.h>

Public Member Functions

 GRIBFile (const wxArrayString &file_names, bool CumRec, bool WaveRec, bool newestFile=false)
 Creates a new GRIBFile by parsing one or more GRIB files.
 
bool IsOK (void)
 Checks if file loading and parsing was successful.
 
wxArrayString & GetFileNames (void)
 Gets the list of source filenames being used.
 
wxString GetLastMessage (void)
 Gets the last error message if file loading failed.
 
ArrayOfGribRecordSets * GetRecordSetArrayPtr (void)
 Gets pointer to array of record sets organized by timestamp.
 
time_t GetRefDateTime (void)
 Gets reference datetime of the GRIB data.
 
const unsigned int GetCounter ()
 
 WX_DEFINE_ARRAY_INT (int, GribIdxArray)
 

Public Attributes

GribIdxArray m_GribIdxArray
 

Detailed Description

Manages multiple GRIB record sets from one or more GRIB files.

GRIBFile is responsible for parsing and organizing weather data from GRIB files. It can handle:

  • Multiple files with different data types (e.g., wind in one file, waves in another).
  • Multiple files with overlapping data.
  • Data from different meteorological models and levels.

The class provides logic for resolving overlapping or conflicting records by:

  • Favoring UV vector components over polar (direction/speed) representations.
  • Preferring mean/average records over instantaneous values.
  • Using Mean-Sea-Level (MSL) pressure over other pressure types.
  • Prioritizing significant wave data over wind wave data.

Definition at line 370 of file GribUIDialog.h.

Constructor & Destructor Documentation

◆ GRIBFile()

GRIBFile::GRIBFile ( const wxArrayString &  file_names,
bool  CumRec,
bool  WaveRec,
bool  newestFile = false 
)

Creates a new GRIBFile by parsing one or more GRIB files.

Parameters
file_namesArray of GRIB file paths to load. Can contain multiple files with different or overlapping data types.
CumRecWhether to copy first cumulative record to fill gaps in precipitation and cloud cover data, preventing artificial zero periods.
WaveRecWhether to copy missing wave records to fill gaps, ensuring continuous marine condition visualization.
newestFileWhen true, only load the newest file from the array. When false (default), combine all records from all files.

Definition at line 2012 of file GribUIDialog.cpp.

◆ ~GRIBFile()

GRIBFile::~GRIBFile ( )

Definition at line 2385 of file GribUIDialog.cpp.

Member Function Documentation

◆ GetCounter()

const unsigned int GRIBFile::GetCounter ( )
inline

Definition at line 421 of file GribUIDialog.h.

◆ GetFileNames()

wxArrayString & GRIBFile::GetFileNames ( void  )
inline

Gets the list of source filenames being used.

When newestFile=true, will contain only the newest file. Otherwise contains all input files.

Definition at line 398 of file GribUIDialog.h.

◆ GetLastMessage()

wxString GRIBFile::GetLastMessage ( void  )
inline

Gets the last error message if file loading failed.

Definition at line 402 of file GribUIDialog.h.

◆ GetRecordSetArrayPtr()

ArrayOfGribRecordSets * GRIBFile::GetRecordSetArrayPtr ( void  )
inline

Gets pointer to array of record sets organized by timestamp.

Contains combined data from all source files (or just newest file if newestFile=true).

Definition at line 408 of file GribUIDialog.h.

◆ GetRefDateTime()

time_t GRIBFile::GetRefDateTime ( void  )
inline

Gets reference datetime of the GRIB data.

The reference time is when the model run started (analysis time). This differs from the forecast time of individual records which is reference_time + forecast_hour. For example, a 24h forecast from a 00Z model run would have reference_time=00Z and forecast_time=00Z+24h.

Definition at line 419 of file GribUIDialog.h.

◆ IsOK()

bool GRIBFile::IsOK ( void  )
inline

Checks if file loading and parsing was successful.

Returns
true if at least one valid GRIB record was loaded.

Definition at line 392 of file GribUIDialog.h.

Member Data Documentation

◆ m_GribIdxArray

GribIdxArray GRIBFile::m_GribIdxArray

Definition at line 424 of file GribUIDialog.h.


The documentation for this class was generated from the following files: