I would like to use tonic to convert some VIC outputs from ASCII to NetCDF format, but when I run ./vic_utils vic2netcdf config_file.cfg
, I get the following key error:
Traceback (most recent call last):
File "./scripts/vic_utils", line 221, in <module>
main()
File "./scripts/vic_utils", line 197, in main
args.func(args)
File "build/bdist.linux-x86_64/egg/tonic/models/vic/vic2netcdf.py", line 512, in _run
File "build/bdist.linux-x86_64/egg/tonic/models/vic/vic2netcdf.py", line 885, in vic2nc
File "build/bdist.linux-x86_64/egg/tonic/models/vic/vic2netcdf.py", line 448, in nc_add_data_to_array
File "/home/jschap/miniconda3/envs/py2/lib/python2.7/site-packages/pandas/core/frame.py", line 2139, in __getitem__
return self._getitem_column(key)
File "/home/jschap/miniconda3/envs/py2/lib/python2.7/site-packages/pandas/core/frame.py", line 2146, in _getitem_column
return self._get_item_cache(key)
File "/home/jschap/miniconda3/envs/py2/lib/python2.7/site-packages/pandas/core/generic.py", line 1842, in _get_item_cache
values = self._data.get(item)
File "/home/jschap/miniconda3/envs/py2/lib/python2.7/site-packages/pandas/core/internals.py", line 3843, in get
loc = self.items.get_loc(item)
File "/home/jschap/miniconda3/envs/py2/lib/python2.7/site-packages/pandas/core/indexes/base.py", line 2527, in get_loc
return self._engine.get_loc(self._maybe_cast_indexer(key))
File "pandas/_libs/index.pyx", line 117, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 139, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1265, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1273, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'Precipitation'
I am confused because it looks like "Precipitation" is in fact in the "fields" dictionary. Any ideas why this error is occurring? tonic reports the configuration options like this:
-------------------------------
Configuration File Options
-------------OPTIONS-------------
input_files: /home/jschap/Documents/ISR/data/Tuolumne/FromAtlantic/Tuo6_VIC_Outputs_nohead/fluxes*
input_file_format: ascii
regular_grid: True
out_directory: /home/jschap/Documents/ISR/data/Tuolumne/
memory_mode: original
chunksize: 100
out_file_prefix: tuo_fluxes
out_file_format: NETCDF4
precision: single
start_date: 2006-01-01-00
end_date: 2011-12-31-00
calendar: proleptic_gregorian
time_segment: year
snow_bands: False
veg_tiles: False
soil_layers: 3
Fields: Precipitation, Evaporation, Runoff, Baseflow, Wdew, Soil_liquid, Swnet, Netrad, Evap_canopy, Transpiration, Bare_soil_evap, Sublimation_canop, Sublimation_snow, Aero_resist, Surface_temp, Albedo, Relhumid, In_long, Air_temp, Wind
--------GLOBAL_ATTRIBUTES--------
title: Tuolumne basin simulation using Livneh forcings and parameters
grid: WGS84
--------RUN MODE--------
Memory Mode: original
---------------------------------