Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSIS2 options updates don't work on iterative calls #59

Closed
greglucas opened this issue Nov 14, 2024 · 0 comments · Fixed by #60
Closed

MSIS2 options updates don't work on iterative calls #59

greglucas opened this issue Nov 14, 2024 · 0 comments · Fixed by #60
Labels
bug Something isn't working

Comments

@greglucas
Copy link
Member

In MSIS2, changing just the options values between runs with identical input values does not update the model as expected.

Example:

import numpy as np

from pymsis import msis

inputs = [np.datetime64("2020-01-01T00:00:00"), 0, 0, 200]
print(msis.run(*inputs, options=[1] * 25))
# Works when updating a different input variable between runs
# msis.run(*inputs, f107s=100, options=[1] * 25)
print(msis.run(*inputs, options=[0] * 25))

Output:

[[1.2876017e-10 1.3775733e+15 1.0593812e+14 2.2085185e+15 7.0838869e+12
  6.8745986e+11 8.9381621e+11 1.1500114e+13 3.1164152e-04 1.6354078e+11
  6.5953455e+02]]
[[1.2876017e-10 1.3775733e+15 1.0593812e+14 2.2085185e+15 7.0838869e+12
  6.8745986e+11 8.9381621e+11 1.1500114e+13 3.1164152e-04 1.6354078e+11
  6.5953455e+02]]

If I remove the commented out line which changes the f107 input values between the runs, then we get the changed output:

[[1.2876017e-10 1.3775733e+15 1.0593812e+14 2.2085185e+15 7.0838869e+12
  6.8745986e+11 8.9381621e+11 1.1500114e+13 3.1164152e-04 1.6354078e+11
  6.5953455e+02]]
[[2.4276986e-10 2.8497382e+15 1.3643071e+14 3.8363507e+15 9.2077776e+12
  1.4904572e+11 2.5547626e+12 3.4595666e+13 8.0233061e-04 1.3265933e+12
  9.2776227e+02]]

This is due to a check in msis_calc.F90 which has a check for all of the input variables, but not for the options changing unfortunately.

    ! If location, time, or solar/geomagnetic conditions change then recompute the profile parameters
    if ((day .ne. lastday)     .or. (utsec .ne. lastutsec)       .or. &
        (lat .ne. lastlat)     .or. (lon .ne. lastlon)           .or. &
        (sflux .ne. lastsflux) .or. (sfluxavg .ne. lastsfluxavg) .or. &
        any(ap .ne. lastap))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant