Bug Description
model2netcdf.ED2 fails if -T- file is missing the variable "AVG_SOIL_TEMP", known as "Soiltemp" in the pecan standard. It fails specifically at this line.
To Reproduce
Steps to reproduce the behavior:
- Run met2model.ED2() on an ED2 generated
-T- file that has no "AVG_SOIL_TEMP" data.
- See error
Expected behavior
The function's assigning Soiltemp the value -999 would mean that the .nc file it produces would have "missing values" of -999 for Soiltemp.
Error message
2020-06-02 16:00:40 WARN [model2netcdf.ED2.R#278: PEcAn.logger::logger.warn] :
Could not find AVG_SOIL_TEMP in ed hdf5 output.
Error in array(0, ncol(soiltemp)) : 'dims' cannot be of length 0
Machine (please complete the following information):
- Server BU test-pecan, Tess' personal build. Up to date with develop.
Additional context
I tried an if(soiltemp != -999){} around the code chunk from line 520 to line 579, but it messed up the dimensions during the write-out step.