star-meteo

Time varying meteorological data
git clone git://git.meso-star.fr/star-meteo.git
Log | Files | Refs | README | LICENSE

smeteo_c.h (1869B)


      1 /* Copyright (C) 2025 |Méso|Star> (contact@meso-star.com)
      2  *
      3  * This program is free software: you can redistribute it and/or modify
      4  * it under the terms of the GNU General Public License as published by
      5  * the Free Software Foundation, either version 3 of the License, or
      6  * (at your option) any later version.
      7  *
      8  * This program is dismshbuted in the hope that it will be useful,
      9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
     11  * GNU General Public License for more details.
     12  *
     13  * You should have received a copy of the GNU General Public License
     14  * along with this program. If not, see <http://www.gnu.org/licenses/>. */
     15 
     16 #ifndef SMETEO_C_H
     17 #define SMETEO_C_H
     18 
     19 #include <rsys/dynamic_array.h>
     20 #include <rsys/logger.h>
     21 #include <rsys/ref_count.h>
     22 #include <rsys/str.h>
     23 
     24 #include <time.h> /* struct tm */
     25 
     26 /* Helper macros for logging */
     27 #define LOG__(Dev, Lvl, Type, ...) { \
     28   if ((Dev)->verbose >= (Lvl)) \
     29     logger_print((Dev)->logger, Type, __VA_ARGS__); \
     30 } (void)0
     31 #define ERROR(Dev, ...) LOG__(Dev, 1, LOG_ERROR,   "error: "__VA_ARGS__)
     32 #define WARN(Dev, ...) LOG__(Dev, 2, LOG_WARNING, "warning: "__VA_ARGS__)
     33 #define INFO(Dev, ...) LOG__(Dev, 3, LOG_OUTPUT,  __VA_ARGS__)
     34 
     35 /* Generate the darray_entry data type and its API */
     36 #define DARRAY_NAME entry
     37 #define DARRAY_DATA struct smeteo_entry
     38 #include <rsys/dynamic_array.h>
     39 
     40 struct smeteo {
     41   struct str filename;
     42 
     43   /* File header */
     44   double longitude; /* Longitude of geographical position [deg] */
     45   double latitude; /* Latitude of geographical position [deg] */
     46   double albedo; /* Ground albedo, for shortwave radiation */
     47 
     48   /* Meteo data */
     49   struct darray_entry entries;
     50 
     51   int verbose; /* Verbosity level */
     52 
     53   struct mem_allocator* allocator;
     54   struct logger* logger;
     55   ref_T ref;
     56 };
     57 
     58 #endif /* SMETEO_C_H */