Esempio n. 1
0
    input_file, output_file = sys.argv[1:]
    print('Input file is:', input_file)
    with open(input_file, 'r') as f:
        input_data = [float(x) for x in f.readline().split()]

    print('Running NATS simulation with input:', input_data)
    sim = TwoAcSim()
    # Execute the simulation.  Note that we also explicitly pass a
    # value for output_file, so that we get a record of the output
    # file.  Conveniently, UQpy coordinates each run in a separate
    # directory, so we will have a record of the NATS trajectory
    # output for each individual simulation that is performed.
    df = sim(output_file='nats_output.csv',
             latitude=input_data[0],
             longitude=input_data[1])['trajectory']
    sep = calc_sep_distance_vs_time(df)
    result = sep['sep'].iloc[-1]
    print('Separation distance:', result)
    print('Wrote results to:', output_file)
    # Running NATS requires a directory change.  By stopping the JVM
    # here, PARA-ATM will automatically return us to the original
    # working directory.  This is necessary so that the output file
    # goes to the right place. (PARA-ATM will automatically stop the
    # JVM when the Python process exits, but we want to do it here
    # prior to writing the output file.)

    NatsEnvironment.stop_jvm()

    with open(output_file, 'w') as f:
        f.write('{}\n'.format(result))
Esempio n. 2
0
 def tearDownClass(cls):
     NatsEnvironment.stop_jvm()