ArcticSnow / TopoPyScale

TopoPyScale: a Python library to perform simplistic climate downscaling at the hillslope scale
https://topopyscale.readthedocs.io
MIT License
39 stars 9 forks source link

export netcdf function from Topoclass #50

Closed paswyss closed 1 year ago

paswyss commented 1 year ago

When no variables defined, the to_netcdf() function of the Topoclass (not topoexport!) raises an error.

Suggestion how to fix it: add the follow at the beginning of the function:

if variables is None:
    variables = list(self.downscaled_pts.keys())

This initializes the variables when not defined to all (which is described as default in the function description.)

Another option would be to remove the sub-setting of 'self.downscaled_pts[variables]' in the te.to_netcdf call and leave it to the topoexport class, which handles it already. But this I would not recommend, since it is prone to errors (when the function changes for example).

ArcticSnow commented 1 year ago

Thank you for pointing the problem out and proposing the solution. Problem should be fixed. Let me know if the last commit solved it. :)

paswyss commented 1 year ago

Yes, it's solved. Thanks :)