ERROR : Variable "" not found in NetCDF file

Ask questions or report problems
pzweifel
Posts: 3
Joined: Mon Oct 03, 2022 7:34 am

ERROR : Variable "" not found in NetCDF file

Postby pzweifel » Tue Sep 26, 2023 7:15 am

Dear all
I adapted the Raven tutorial files for HBV for multiple catchments in Switzerland. Forcings are read from netCDF files. When trying to run Raven.exe, it will give an error for some catchments:

Code: Select all

============================================================
                        RAVEN                               
 a robust semi-distributed hydrological modelling framework
    Copyright 2008-2023, the Raven Development Team
                    Version 3.7 w/ netCDF
                BuildDate Aug  7 2023
============================================================
Generating Master Parameter List...
Autocalculating Model Parameters...
...done Autocalculating.
Checking for Required Model Parameters...
...Done Checking
...model input successfully parsed

======================================================
Initializing Model...
  Generating Gauge Interpolation Weights...
  Calculating basin & watershed areas...
  Calculating routing network topology...
  Initializing Basins, calculating watershed area, setting initial flow conditions...
  Calculating initial system water storage...
==MODEL SUMMARY=======================================
       Model Run: CH-0053_HBV
    rvi filename: CH-0053_HBV.rvi
Output Directory: output/
     # SubBasins: 1 (0 reservoirs) (0 disabled)
          # HRUs: 33 (0 disabled)
        # Gauges: 1
#State Variables: 15
                - Surface Water (SURFACE_WATER)
                - Cum. Losses to Atmosphere (ATMOSPHERE)
                - Cum. Precipitation (ATMOS_PRECIP)
                - Ponded Water (PONDED_WATER)
                - Runoff (RUNOFF)
                - Soil Water[0] (SOIL[0])
                - Soil Water[1] (SOIL[1])
                - Soil Water[2] (SOIL[2])
                - Snow Melt (Liquid) (SNOW_LIQ)
                - Snow (SNOW)
                - Canopy (CANOPY)
                - Actual Evapotranspiration (AET)
                - Canopy Snow (CANOPY_SNOW)
                - Glacier Liquid Storage (GLACIER)
                - Glacier Ice (GLACIER_ICE)
     # Processes: 17
                - Snow Refreeze
                - Precipitation
                - Canopy Evaporation
                - Canopy Snow Sublimation
                - Snow Melt & Refreeze
                - Overflow
                - Flush
                - Glacier Melt
                - Glacier Release
                - Infiltration
                - Flush
                - Soil Evaporation
                - Capillary Rise
                - Lake Evaporation
                - Percolation
                - Baseflow
                - Baseflow
    #Connections: 33
#Lat.Connections: 0
        Duration: 14610 d
       Time step: 1 d (1440 min)
  Watershed Area: 1518.49 km2 (simulated) of 1518.49 km2
======================================================

*******************************************************

WARNING: Warnings have been issued while parsing data.
         See Raven_errors.txt for details             

*******************************************************


======================================================
Simulation Start...
1981-01-01
1981-02-01
1981-03-01
1981-04-01
1981-05-01
1981-06-01
1981-07-01
1981-08-01
1981-09-01
1981-10-01
1981-11-01
1981-12-01


============== Exiting Gracefully ==========================
Exiting Gracefully: Variable "" not found in NetCDF file data_obs/TabsD_v2.0_swiss.lv95/out/TabsD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
Error Type: Bad input data
============================================================


This error occurs with Raven 3.5 and 3.7. Additionally, emulation of GR4J, HMETS, HYMOD and MOHYSE did not produce this error, using the same forcing files.

I would be grateful for any ideas.
Cheers, Peter

rchlumsk
Posts: 156
Joined: Fri Sep 16, 2016 3:18 pm

Re: ERROR : Variable "" not found in NetCDF file

Postby rchlumsk » Tue Sep 26, 2023 9:32 am

Hi Peter

Could you please confirm that you ran the model for the same time period as the one producing the error here with the other model emulations?

Could you also post all or some of your rvt file that shows the connection to your netcdf file?

I can't think offhand why this would occur in the HBV model and not other emulations, unless there is perhaps missing data in a specific forcing variable that is not used or read in other model configurations (?). Once you post your rvt section (:GriddedForcing sections) connecting forcing data to Raven that may give some clues.

Thanks,
Rob
Robert Chlumsky
rchlumsk@uwaterloo.ca

pzweifel
Posts: 3
Joined: Mon Oct 03, 2022 7:34 am

Re: ERROR : Variable "" not found in NetCDF file

Postby pzweifel » Fri Oct 20, 2023 5:22 am

Dear Rob,

Thank you for your ideas, I really appreciate it! And please excuse my delayed response.
Below you will find two .rvt files, the first one for the HBV model, the second one for GR4J as a comparison.
Moreover, I can confirm that all the models use the same time periods.

Peter

Code: Select all

#########################################################################
:FileType          rvt ASCII Raven 3.5
:WrittenBy         Peter Zweifel
:CreationDate      March 2023
#
# Emulation of HBV simulation of CH-0053
#------------------------------------------------------------------------
# meteorological forcings
:GriddedForcing           Rainfall
    :ForcingType          RAINFALL
    :FileNameNC           data_obs/RhiresD_v2.0_swiss.lv95/out/RhiresD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            RhiresD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053_hbv.txt
:EndGriddedForcing
:GriddedForcing           Average Temperature
    :ForcingType          TEMP_AVE
    :FileNameNC           data_obs/TabsD_v2.0_swiss.lv95/out/TabsD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            TabsD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053_hbv.txt
:EndGriddedForcing
:GriddedForcing           Maximum Temperature
    :ForcingType          TEMP_MAX
    :FileNameNC           data_obs/TmaxD_v2.0_swiss.lv95/out/TmaxD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            TmaxD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053_hbv.txt
:EndGriddedForcing
:GriddedForcing           Minimum Temperature
    :ForcingType          TEMP_MIN
    :FileNameNC           data_obs/TminD_v2.0_swiss.lv95/out/TminD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            TminD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053_hbv.txt
:EndGriddedForcing
:Gauge TicBel
  :Latitude    46.1937678777783
  :Longitude 9.009287121514497
  :Elevation  220

  :RainCorrection    1.0
  :SnowCorrection    1.0

  :MonthlyAveEvaporation 2.295952380952381 5.429024390243902 26.551463414634142 53.47 68.2270731707317 85.03780487804879 100.79536585365852 79.02853658536586 41.057073170731705 16.60951219512195 6.859756097560975 4.121219512195122
  :MonthlyAveTemperature 0.6957448203514294 1.5147344559585492 5.447413453973249 9.020047425474255 13.224091922370837 16.910108401084013 19.08879491214267 18.532664568581172 14.556981707317073 9.99764948859166 4.609478319783197 1.6629556779438763

:EndGauge

# observed streamflow
:RedirectToFile data_obs/TicBel_Q_2020_daily.rvt


Code: Select all

#########################################################################
:FileType          rvt ASCII Raven 3.5
:WrittenBy         Peter Zweifel
:CreationDate      March 2023
#
# Emulation of GR4J simulation of CH-0053
#------------------------------------------------------------------------
# meteorological forcings
:GriddedForcing           Rainfall
    :ForcingType          RAINFALL
    :FileNameNC           data_obs/RhiresD_v2.0_swiss.lv95/out/RhiresD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            RhiresD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053.txt
:EndGriddedForcing
:GriddedForcing           Average Temperature
    :ForcingType          TEMP_AVE
    :FileNameNC           data_obs/TabsD_v2.0_swiss.lv95/out/TabsD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            TabsD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053.txt
:EndGriddedForcing
:GriddedForcing           Maximum Temperature
    :ForcingType          TEMP_MAX
    :FileNameNC           data_obs/TmaxD_v2.0_swiss.lv95/out/TmaxD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            TmaxD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053.txt
:EndGriddedForcing
:GriddedForcing           Minimum Temperature
    :ForcingType          TEMP_MIN
    :FileNameNC           data_obs/TminD_v2.0_swiss.lv95/out/TminD_v2.0_swiss.lv95_198101010000_202012310000_CH-0053_clipped.nc
    :VarNameNC            TminD
    :DimNamesNC           E N time     # must be in the order of (x,y,t)
    :RedirectToFile       data_obs/RhiresD_v2.0_swiss.lv95/out/grid_weights_CH-0053.txt
:EndGriddedForcing
:Gauge TicBel
  :Latitude    46.1937678777783
  :Longitude 9.009287121514497
  :Elevation  220

:EndGauge

# observed streamflow
:RedirectToFile data_obs/TicBel_Q_2020_daily.rvt

rchlumsk
Posts: 156
Joined: Fri Sep 16, 2016 3:18 pm

Re: ERROR : Variable "" not found in NetCDF file

Postby rchlumsk » Fri Oct 27, 2023 2:24 pm

Hi Peter

I notice that the first rvt file for the HBV model has the extra gauge with monthly averaged forcings, while the second rvt file has the gauge defined with no information. Can you provide more context to that gauge? I would consider commenting out that extra non-gridded gauge entirely or at least keeping it consistent between setups if possible.

Second, just as a check - is the first forcing meant to be strictly RAINFALL or PRECIP? I would also be curious as to what the :RainSnowFractionation method you are using in the rvi file with each setup. My thought is if something is breaking when snow would begin to appear in some catchments with this gauge and/or rainsnow_fractionation discrepancy.

Please confirm those items for me and we can keep digging.

Thanks,
Rob
Robert Chlumsky
rchlumsk@uwaterloo.ca

pzweifel
Posts: 3
Joined: Mon Oct 03, 2022 7:34 am

Re: ERROR : Variable "" not found in NetCDF file

Postby pzweifel » Mon Oct 30, 2023 4:08 pm

Hi Rob

The gauge info for my GR4J, MOHYSE, HMETS and HYMOD models is an artifact, I guess. I started with forcings that were measured at that gauge and later switched to gridded data. So I could comment them out.
To create the .rvi files, I used the template from the appendix F in the manual. Since HBV uses PET_FROMMONTHLY, I provide the monthly data in the :Gauge/:EndGauge command in its .rvt file.

The first forcing is meant to be PRECIP, I now changed it.

The :RainSnowFraction methods I use are as follows:
GR4J: RAINSNOW_DINGMAN
HBV: RAINSNOW_HBV
HMETS: RAINSNOW_DATA
HYMOD: RAINSNOW_THRESHOLD
MOHYSE: RAINSNOW_DATA


Return to “Help & Support”