Skip to content

Improve create_sunrun flexibility #17

@joshua-laughner

Description

@joshua-laughner

Historically, sites that need to correct values in their .gop sunrun files beyond what the xx_sunrun.dat file supports have had to modify the .gop file manually, modify it with an external script, or create a custom version of create_sunrun. The downside to the first two is that it is difficult to reproduce those changes at another location (to run GGG in these cases, we either need the .gop created by the site or the script they used to modify it - which may rely on external dependencies or data) and the downside to the second is that users have to customize Fortran code.

In the future, I think we can encapsulate a lot of the needed flexibility by extending the xx_sunrun.dat file into a fully fledged TOML file. The existing xx_sunrun.dat information can go in one table:

[static]
# 1 = MkIV, 2 = TCCON, 3 = other
instrument = 2

# 1 = moon, 2 = sun
object = 2

# Site coordinates, south and west are negative. Altitude is in kilometers above sea level
obs_lat = 45.9448
obs_lon = -90.2732
obs_alt = 0.476

# Constant pressure correction. Use only if the ENTIRE record has an offset,
# otherwise, use the time period/spectrum specific tables below. Value must be in hPa
pout_corr = 0.0

frequency_shift_factor = 0.99999999
laser_frequency = 15798.0138
tracker_wavenumber = 9900.0
airmass_independent_path_length = 0.002
telescope_magnification = 1.0

[[static.detectors]]
label = "a"
label_index_start = 16
label_index_end = 16
start_freq = 4000
end_freq = 11000

[[static.detectors]]
label = "b"
label_index_start = 16
label_index_end = 16
start_freq = 11000
end_freq = 15000

[[static.detectors]]
label = "c"
label_index_start = 16
label_index_end = 16
start_freq = 1800
end_freq = 6000

[static.null_values]
tins = 999.0
hins = 999.0
pins = 999.0
tout = 999.0
hout = 999.0
pout = 999.0
fvsi = 999.0
wspd = 999.0
wdir = 999.0

Then we can have two other tables. One defines changes by time range, and possibly lat/lon range:

[[modify_range]]
time_range = ["2026-05-28", "2026-06-01"]

[[modify_range]]
time_range = ["2020-01-01", "2020-02-01"]
lat_range = [-46.0, -45.0]
lon_range = [-90.0, -89.0]

The other would define specific spectra:

[[modify_spectra]]
spectrum = "pa20040721saaaa?.043"

In this example, we show the use of the ? wildcard to match any detector.

For both of these, they would contain a change subtable that defines which columns to change. The keys under change would map to any sunrun column. These would be able to define either a constant value to insert or a linear correction:

[[modify_range]]
time_range = ["2026-05-28", "2026-06-01"]
[modify_range.change]
# Linear correction, x_corr = multiplier * x_orig + offset
pout = {multiplier = 0.95, offset = 5.0}

[[modify_spectra]]
spectrum = "pa20040721saaaa?.043"
[modify_spectra.change]
tout = { value = 25.0 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions