noaa-ocs-modeling / EnsemblePerturbation

perturbation of coupled model input over a space of input variables
https://ensembleperturbation.readthedocs.io
Creative Commons Zero v1.0 Universal
7 stars 3 forks source link

parameter space discussion #57

Closed WPringle closed 2 years ago

WPringle commented 3 years ago

@zacharyburnettNOAA Wondering if you were able to get the UQTk package compiled before?

I keep getting linkage problem to lapack/blas:

[ 80%] Building CXX object cpp/app/generate_quad/CMakeFiles/generate_quad.dir/generate_quad.cpp.o
ld: cannot find -llapack
ld: cannot find -lblas
ld: cannot find -llapack
make[2]: *** [cpp/app/gen_mi/gen_mi] Error 1
make[1]: *** [cpp/app/gen_mi/CMakeFiles/gen_mi.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

Just wondering if you were successful and encountered any issues?

ghost commented 3 years ago

I have not looked into UQTk, instead I am looking at how to implement examples from chaospy (https://chaospy.readthedocs.io/en/master/user_guide/quick_tutorial.html). I figure we can formalize the distributions of each variable and then use chaospy to perform UQ? I'm still reading up on it.

WPringle commented 3 years ago

@zacharyburnettNOAA Cool, yeah I can ask Khachik more about how to use UQTk on Wednesday. Thanks for looking into chaospy too. I was finally able to compile UQTk on another machine. It was very finicky for what versions of compilers and other things to use.

ghost commented 3 years ago

@WPringle I'm still a bit confused on the whole structure of the UQ, would you mind if we had a video chat about it when you have the time?

WPringle commented 3 years ago

@zacharyburnettNOAA Me too :) I think that's what we want to find out more from Khachik. But I can chat now if you are free. I'll be a bit busy rest of the day.

ghost commented 3 years ago

@WPringle sorry, just saw this. Are you still free? If not, then that is fine. I'll be here if you want to drop in: https://meet.google.com/std-vovd-vca

ghost commented 3 years ago

I followed the chaospy examples to make a script that works on our 4 variables:

import chaospy
from matplotlib import pyplot
import numpy

from ensembleperturbation.perturbation.atcf import \
    PerturbationType, VortexPerturbedVariable

if __name__ == '__main__':
    distributions = {}
    for perturbed_variable in VortexPerturbedVariable.__subclasses__():
        name = perturbed_variable.name
        perturbation = perturbed_variable.perturbation_type
        if perturbation == PerturbationType.GAUSSIAN:
            distributions[name] = chaospy.Normal(0, 1)
        elif perturbation == PerturbationType.UNIFORM:
            distributions[name] = chaospy.Uniform(-1, 1)

    joint_distribution = chaospy.J(*distributions.values())

    grid = numpy.mgrid[-2:2:100j, -1:1:100j]
    pyplot.contourf(grid[0], grid[1], joint_distribution.pdf(grid), 100)
    pyplot.scatter(*joint_distribution.sample(100, rule="sobol"))
    pyplot.show()

    print('done')

sobol

WPringle commented 3 years ago

Ok I have another meeting in a few minutes, I'll try again if there is some free time later this afternoon and see if you're on.

WPringle commented 3 years ago

Oh that's interesting, so the x axis is the gaussian and the y axis the uniform parameters? I think is the type of thing we want for choosing the parameter space effectively.

ghost commented 3 years ago

made new pull request #59

ghost commented 3 years ago

@WPringle I put Khachik's example scripts onto the feature/chaospy branch (3aa1d62), I'm looking through the functions. Additionally, I'm also spinning up some runs with NWS=8 (checking for that this time) so that should have some more variability in Rmax

WPringle commented 3 years ago

@zacharyburnettNOAA Cool thanks~