Fix references inside variables

Inside a NetCDF variable definition the variables cannot be reused, eg,
as in:

    temperature = Variable(
        ...
        valid_max = 90.,
        valid_min = -90.,
        valid_range = (valid_min, valid_max),
    )

This is because here `valid_max` and `valid_min` are not Python
variables; instead, they are keyword arguments passed to the function,
so they have no scope.

Unfortunately the only way to declare this is by having duplicate
values, ie:

    temperature = Variable(
        ...
        valid_max = 90.,
        valid_min = -90.,
        valid_range = (-90., 90.),
    )
Automate the size detection

I've added code that automates the calculation of the data size.