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

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

#include <grib_ui_dlg.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 () const
 Checks if file loading and parsing was successful.
 
wxArrayString & GetFileNames ()
 Gets the list of source filenames being used.
 
wxString GetLastMessage ()
 Gets the last error message if file loading failed.
 
ArrayOfGribRecordSets * GetRecordSetArrayPtr ()
 Gets pointer to array of record sets organized by timestamp.
 
time_t GetRefDateTime () const
 Returns the reference datetime of the GRIB data, as the number of seconds since the epoch.
 
unsigned int GetCounter () const
 
 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 431 of file grib_ui_dlg.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 2016 of file grib_ui_dlg.cpp.

◆ ~GRIBFile()

GRIBFile::~GRIBFile ( )

Definition at line 2389 of file grib_ui_dlg.cpp.

Member Function Documentation

◆ GetCounter()

unsigned int GRIBFile::GetCounter ( ) const
inline

Definition at line 483 of file grib_ui_dlg.h.

◆ GetFileNames()

wxArrayString & GRIBFile::GetFileNames ( )
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 459 of file grib_ui_dlg.h.

◆ GetLastMessage()

wxString GRIBFile::GetLastMessage ( )
inline

Gets the last error message if file loading failed.

Definition at line 463 of file grib_ui_dlg.h.

◆ GetRecordSetArrayPtr()

ArrayOfGribRecordSets * GRIBFile::GetRecordSetArrayPtr ( )
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 469 of file grib_ui_dlg.h.

◆ GetRefDateTime()

time_t GRIBFile::GetRefDateTime ( ) const
inline

Returns the reference datetime of the GRIB data, as the number of seconds since the epoch.

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 481 of file grib_ui_dlg.h.

◆ IsOK()

bool GRIBFile::IsOK ( ) const
inline

Checks if file loading and parsing was successful.

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

Definition at line 453 of file grib_ui_dlg.h.

Member Data Documentation

◆ m_GribIdxArray

GribIdxArray GRIBFile::m_GribIdxArray

Definition at line 486 of file grib_ui_dlg.h.


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