/*************************************************************************** * Copyright (C) 2005 by Nicolas PASCAL * * nicolas.pascal@icare.univ-lille1.fr * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef GMAOFILEDATA_H #define GMAOFILEDATA_H #include "meteofiledata.h" #include "hdffiledata.h" /** @file gmaofiledata.h Manage the reading of DAO/GMAO meteo files @warning not all GMAO products are supported at this time @warning GMAO-3 files are not supported Uses some pieces of code developped by Franck Gabarrot @author Nicolas PASCAL History : - 08/2005 : creation - 20/06/2007 : refundation of the interface in a more generic way and adding support of GMAO-5 files */ /** @class GMAOFileData generic class to manage the reading of GMAO meteo files */ class GMAOFileData : virtual public FileData, public MeteoFileData, public HDFFileData { /** The name of the field that contains the latitudes data */ static const std::string latitude_name; /** The name of the field that contains the longitudes data */ static const std::string longitude_name; /** The name of the field that contains the heights data */ static const std::string height_name; /** The name of the field that contains the times data */ static const std::string time_name; /** The GEOS version of the GMAO product */ int geos_version; /** The GMAO product ID extracted from the filename */ string product_id; /** * @brief Initialize some attributes */ void init(); /** * @brief set the GEOS version of the file * If @a geos_version is 0, the method tries to guess it using the filename. If not null, only set it to the given value * @param geos_version the GEOS version of the product. If null, guess it */ void set_geos_version(const int geos_version); public: /** * @brief constructor * @param name the name (path included) of the file to be opened * @param geos_version the geos version of the product. If 0 (default), the class tries to automatically set it */ GMAOFileData(const string& name = "", const int geos_version=0); /** * @brief Destructor */ ~GMAOFileData(); /** * @brief read the fill value of the sds given in parametre * This overrides the hdffiledata get_sds_fill_value method because in GMAO files, the fill value has a non standard name "missing_value" * @param sds_name the name of the sds where to read the fill value * @param fill_value (output) the read value. Must not be NULL */ void get_sds_fill_value(const string &sds_name, void* fill_value); /** * @brief Accessor to the product ID * @return the product ID */ string get_product_id() const { return product_id; } /** * @brief Accessor to the GEOS version * @return the GEOS major version number */ int get_geos_version() const { return geos_version; } protected: /** * @brief the bigger valid indexes for the geolocation : format {lat_index, lon_index} */ int lat_lon_index_max[2]; /** Check is a the file is a valid meteo data file ( the analysis is done with a filename parsing, not with parsing the data inside ) @param short_filename string : the filename without its path @return bool : true if the filename seems to be valid, false else or in case of problem (exception...) */ bool check_filename( const string& short_filename ) const; /** Once the filename has been checked (that's a precondition : no verification on it are done in this method), some informations can be extracted of it : - the date - the hour @param short_filename string : the filename without its path */ void parse_filename( const string& short_filename ); /** * @brief if not already set, read the pressure levels in the file * If the product is a 2D one, no pressure levels are defined. In this case, nothing's done. */ void load_height_level(); /** * @brief if not already set, read the time levels in the file * If the product is a 2D one, no time levels are defined. In this case, nothing's done. */ void load_time_level(); }; #endif