Example #1
0
def calculate(process_name, tasks, results):
    print('[%s] evaluation routine starts' % process_name)

    while True:
        new_value = tasks.get()
        if new_value == "None":
            print('[%s] evaluation routine quits' % process_name)

            # Indicate finished
            results.put(-1)
            break
        else:
            # Initialise icestupa object
            location = new_value
            icestupa = Icestupa(location)

            # Derive all the input parameters
            icestupa.derive_parameters()
            # icestupa.read_input()

            # Generate results
            icestupa.melt_freeze()

            # Summarise and save model results
            icestupa.save()

            # Read Output
            # icestupa.read_output()

            # Create figures for web interface
            icestupa.summary_figures()

            # Compute result and mimic a long-running task
            compute = icestupa.df.iceV.max()

            # Output which process received the value
            print('[%s] received value: %s' % (process_name, new_value))
            print('[%s] calculated max ice volume: %.1f' %
                  (process_name, compute))

            # Add result to the queue
            results.put(compute)

    return
Example #2
0
    answers = dict(
        # location="Schwarzsee 2019",
        location="Guttannen 2021",
        # location="Gangles 2021",
        run="yes",
        # run="no",
    )

    # Initialise icestupa object
    # icestupa = Icestupa(answers["location"], params='best')
    icestupa = Icestupa(answers["location"])

    if answers["run"] == "yes":
        # Derive all the input parameters
        icestupa.derive_parameters()

        # Generate results
        icestupa.melt_freeze(test=True)
        # icestupa.melt_freeze()

        # Summarise and save model results
        icestupa.save()

        # Create figures for web interface
        icestupa.summary_figures()
    else:
        # Use output parameters from cache
        icestupa.read_output()
        icestupa.summary_figures()