Logging

Say we query a NetCDF file for a few timestamps

pvgis series select \
    data/sample_era5landplus_t2m_over_esti.nc \
    8.628 45.812 \
    --neighbor-lookup nearest \
    '2014-12-31 12:00:00, 2015-12-31 12:00:00,2016-12-31 12:00:00,2017-12-31 12:00:00,2018-12-31 12:00:00'
-0.1983587,3.7281141,7.7046404,5.1725235,12.022321

We can use some logging flags to get details around several steps of the requested operation. In example, let's add -l to the same command

pvgis series select \
    data/sample_era5landplus_t2m_over_esti.nc \
    8.628 45.812 \
    --neighbor-lookup nearest \
    '2014-12-31 12:00:00, 2015-12-31 12:00:00,2016-12-31 12:00:00,2017-12-31 12:00:00,2018-12-31 12:00:00' \
    -l
-0.1983587,3.7281141,7.7046404,5.1725235,12.022321

We can also try --log

pvgis --log series \
    select \
    data/sample_era5landplus_t2m_over_esti.nc \
    8.628 45.812 \
    --neighbor-lookup nearest \
    '2014-12-31 12:00:00, 2015-12-31 12:00:00,2016-12-31 12:00:00,2017-12-31 12:00:00,2018-12-31 12:00:00'
-0.1983587,3.7281141,7.7046404,5.1725235,12.022321

or even --log-rich

pvgis --log-rich series \
    select \
    data/sample_era5landplus_t2m_over_esti.nc \
    8.628 45.812 \
    --neighbor-lookup nearest \
    '2014-12-31 12:00:00, 2015-12-31 12:00:00,2016-12-31 12:00:00,2017-12-31 12:00:00,2018-12-31 12:00:00'
[08/07/26 16:04:18]
DEBUG    Object DatetimeIndex(['2014-12-31 12:00:00', '2015-12-31 12:00:00',                               caching.py:62
                        '2016-12-31 12:00:00', '2017-12-31 12:00:00',                                                   
                        '2018-12-31 12:00:00'],                                                                         
                       dtype='datetime64[us]', freq=None) is unhashable.                                                
DEBUG    Object ['t2m'] is unhashable.                                                                     caching.py:62
DEBUG    Data file in /builds/pvgis/pvgis/data : sample_era5landplus_t2m_over_esti.nc                      select.py:105
DEBUG    Scale factor : None, Offset : None                                                                select.py:107
DEBUG    Requested location coordinates : 8.628, 45.812                                                    select.py:117
DEBUG    i Executing data selection function : select_location_time_series()                                 open.py:504
DEBUG      ✓ Location specific dimensions detected in 't2m' : longitude, latitude                            open.py:410
DEBUG      ✓ Coordinates : 8.628, 45.812.                                                                    open.py:430
DEBUG      < Returning selected location from time series : <xarray.DataArray 't2m' (time: 96432)> Size:     open.py:575
         386kB                                                                                                          
         array([1.5442892 , 1.5442892 , 1.7939669 , ..., 0.80042255, 0.68867517,                                        
                0.7804081 ], shape=(96432,), dtype=float32)                                                             
         Coordinates:                                                                                                   
           * time       (time) datetime64 771kB 2014-01-01 ... 2024-12-31T23:00:00                                      
             latitude   float64 8B 45.8                                                                                 
             longitude  float64 8B 8.6                                                                                  
         Attributes:                                                                                                    
             _FillValue:  nan                                                                                           
             units:       C                                                                                             
DEBUG    Selected location from time series : <xarray.DataArray 't2m' (time: 96432)> Size: 386kB           select.py:135
         array([1.5442892 , 1.5442892 , 1.7939669 , ..., 0.80042255, 0.68867517,                                        
                0.7804081 ], shape=(96432,), dtype=float32)                                                             
         Coordinates:                                                                                                   
           * time       (time) datetime64 771kB 2014-01-01 ... 2024-12-31T23:00:00                                      
             latitude   float64 8B 45.8                                                                                 
             longitude  float64 8B 8.6                                                                                  
         Attributes:                                                                                                    
             _FillValue:  nan                                                                                           
             units:       C                                                                                             
DEBUG    Selected timestamps from location time series : <xarray.DataArray 't2m' (time: 5)> Size: 20B      select.py:217
         array([-0.1983587,  3.7281141,  7.7046404,  5.1725235, 12.022321 ],                                            
               dtype=float32)                                                                                           
         Coordinates:                                                                                                   
           * time       (time) datetime64 40B 2014-12-31T12:00:00 ... 2018-12-31T1...                                   
             latitude   float64 8B 45.8                                                                                 
             longitude  float64 8B 8.6                                                                                  
         Attributes:                                                                                                    
             _FillValue:  nan                                                                                           
             units:       C                                                                                             
DEBUG    Object DatetimeIndex(['2014-12-31 12:00:00', '2015-12-31 12:00:00',                               caching.py:62
                        '2016-12-31 12:00:00', '2017-12-31 12:00:00',                                                   
                        '2018-12-31 12:00:00'],                                                                         
                       dtype='datetime64[us]', freq=None) is unhashable.                                                
-0.1983587,3.7281141,7.7046404,5.1725235,12.022321

Finally, we can export to a log file via --log-file series_select.log and increase the level using -llll

pvgis --log-file ./docs/data/series_select.log \
    -llll \
    series select \
    data/sample_era5landplus_t2m_over_esti.nc \
    8.628 45.812 \
    --neighbor-lookup nearest \
    '2014-12-31 12:00:00, 2015-12-31 12:00:00,2016-12-31 12:00:00,2017-12-31 12:00:00,2018-12-31 12:00:00'
-0.1983587,3.7281141,7.7046404,5.1725235,12.022321
The log file