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

Freq jac #867

Merged
merged 8 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,21 @@
ws.spectral_radiance_space_agendaSet(option="UniformCosmicBackground")
ws.spectral_radiance_surface_agendaSet(option="Blackbody")
ws.ray_path_observer_agendaSet(option="Geometric")
ws.spectral_radiance_observer_agendaSet(option="EmissionUnits")
ws.spectral_radiance_observer_agendaSet(option="Emission")

# %% Set up a sensor with Gaussian channel widths on individual frequency ranges
# %% Set up a sensor with Gaussian standard deviation channel widths on individual frequency ranges

pos = [100e3, 0, 0]
los = [180.0, 0.0]
ws.measurement_sensorSimpleGaussian(fwhm=1e5, pos=pos, los=los, pol="RC")
ws.measurement_sensorSimpleGaussian(std=1e5, pos=pos, los=los, pol="RC")

# %% Core calculations

result = pyarts.arts.Vector()
result_jac = pyarts.arts.Matrix()
ws.measurement_vectorFromSensor(result, result_jac)
ws.measurement_vectorFromSensor()

# %% Show results

plt.plot((ws.frequency_grid - line_f0) / 1e6, result)
plt.plot((ws.frequency_grid - line_f0) / 1e6, ws.measurement_vector)
plt.xlabel("Frequency offset [MHz]")
plt.ylabel("Spectral radiance [K]")
plt.title(
Expand All @@ -61,20 +59,20 @@
# %% Test

assert np.allclose(
result[::100],
ws.measurement_vector[::100],
np.array(
[
227.78646795,
230.8638575,
234.80652899,
240.36081974,
249.78247057,
207.62113428,
249.78190355,
240.35972683,
234.80495168,
230.86180615,
227.78395156,
227.85626271,
230.93430882,
234.89998118,
240.50100578,
250.05272664,
209.9140708,
249.51258095,
240.21976958,
234.71155853,
230.79135297,
227.73970752,
]
),
)
3 changes: 1 addition & 2 deletions examples/getting-started/3-disort/1.clearsky-radiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
toa=toa, basename="planets/Earth/afgl/tropical/", missing_is_zero=1
)
ws.atmospheric_fieldIGRF(time="2000-03-11 14:39:37")
# ws.atmospheric_field[pyarts.arts.AtmKey.t] = 300.0

# %% Checks and settings

Expand All @@ -42,7 +41,7 @@

# %% Core Disort calculations

ws.disort_spectral_radiance_fieldClearsky(
ws.disort_spectral_radiance_fieldSunlessClearsky(
longitude=lon,
latitude=lat,
disort_quadrature_dimension=NQuad,
Expand Down
2 changes: 1 addition & 1 deletion examples/getting-started/3-disort/2.clearsky-flux.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

# %% Core Disort calculations

ws.disort_settings_agendaSet(option="Clearsky")
ws.disort_settings_agendaSet(option="SunlessClearsky")

ws.ray_pathGeometricDownlooking(longitude=lon, latitude=lat, max_step=40_000)
ws.ray_path_atmospheric_pointFromPath()
Expand Down
18 changes: 9 additions & 9 deletions python/src/pyarts/plots/ppvar_atm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ def plt_info(atm, keys=[]):
for key in keys:
if isinstance(key, pyarts.arts.ArrayOfSpeciesTag):
out[key] = Info("linear", f"VMR {key} [-]", 1)
elif isinstance(key, pyarts.arts.options.AtmKey):
if key == pyarts.arts.options.AtmKey.t:
elif isinstance(key, pyarts.arts.AtmKey):
if key == pyarts.arts.AtmKey.t:
out[key] = Info("linear", "Temperature [K]", 1)
elif key == pyarts.arts.options.AtmKey.p:
elif key == pyarts.arts.AtmKey.p:
out[key] = Info("log", "Pressure [Pa]", 1)
elif key == pyarts.arts.options.AtmKey.mag_u:
elif key == pyarts.arts.AtmKey.mag_u:
out[key] = Info("linear", "Magnetic u-component [µT]", 1e6)
elif key == pyarts.arts.options.AtmKey.mag_v:
elif key == pyarts.arts.AtmKey.mag_v:
out[key] = Info("linear", "Magnetic v-component [µT]", 1e6)
elif key == pyarts.arts.options.AtmKey.mag_w:
elif key == pyarts.arts.AtmKey.mag_w:
out[key] = Info("linear", "Magnetic w-component [µT]", 1e6)
elif key == pyarts.arts.options.AtmKey.wind_u:
elif key == pyarts.arts.AtmKey.wind_u:
out[key] = Info("linear", "Wind u-component [m/s]", 1)
elif key == pyarts.arts.options.AtmKey.wind_v:
elif key == pyarts.arts.AtmKey.wind_v:
out[key] = Info("linear", "Wind v-component [m/s]", 1)
elif key == pyarts.arts.options.AtmKey.wind_w:
elif key == pyarts.arts.AtmKey.wind_w:
out[key] = Info("linear", "Wind w-component [m/s]", 1)
else:
assert False, "Unknown key type"
Expand Down
7 changes: 7 additions & 0 deletions python/test/workspace/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ def test_method_agenda_variables_io(self):
vars = list(allvars.keys())
mets = pyarts.arts.globals.workspace_methods()
ages = pyarts.arts.globals.workspace_agendas()
opts = pyarts.arts.globals.option_groups()

res = {}
for var in vars:
Expand All @@ -189,13 +190,19 @@ def test_method_agenda_variables_io(self):
if var in ages[ag].input or var in ages[ag].output:
ok_anyways = True
break

# Allow options to be pure input
if nout == 0 and allvars[var].type in opts:
ok_anyways = True

# Allow agendas to be pure input
if nin != 0 and allvars[var].type == "Agenda":
ok_anyways = True

if not ok_anyways:
bad_vars.append(f"{var}")


bad_vars.sort()
assert len(bad_vars) == 0, (
"Should have no pure input/output variables,\n"
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ add_custom_target(UtilityHeadersArts SOURCES ${HEADERFILES})
add_library(workspace_group STATIC
workspace_groups.cpp
)
target_link_libraries(workspace_group PRIVATE arts_options)

add_executable(make_auto_wsg make_auto_wsg.cpp)
add_custom_command(OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ add_subdirectory(matpack)
add_subdirectory(rtepack)
add_subdirectory(predefined)
add_subdirectory(operators)
add_subdirectory(jacobian)
add_subdirectory(fwd)
add_subdirectory(lbl)
add_subdirectory(lookup)
Expand Down Expand Up @@ -48,7 +49,6 @@ add_library(artscore STATIC
geodetic.cc
igrf13.cc
interpolation.cc
jacobian.cc
jpl_species.cc
lineshapemodel.cc
mc_antenna.cc
Expand All @@ -60,7 +60,6 @@ add_library(artscore STATIC
radiation_field.cc
raw.cc
refraction.cc
retrieval_target.cc
sensor.cc
special_interp.cc
sun.cc
Expand Down Expand Up @@ -93,6 +92,7 @@ target_link_libraries(artscore PUBLIC
util
disort-cpp
legendre
jacobian
)

target_include_directories(artscore PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion src/core/absorption/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ add_library(absorption STATIC
predefined_absorption_models.cc
)
target_link_libraries(absorption PUBLIC path predef physics lbl)
target_include_directories(absorption PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_include_directories(absorption PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
2 changes: 1 addition & 1 deletion src/core/atm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_library(atm STATIC atm.cpp)

target_link_libraries(atm PUBLIC matpack operators quantum species physics)
target_include_directories(atm PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_include_directories(atm PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
2 changes: 1 addition & 1 deletion src/core/fwd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ add_library(fwd STATIC
fwd_spectral_radiance.cpp
)
target_link_libraries(fwd PUBLIC path absorption)
target_include_directories(fwd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
target_include_directories(fwd PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
6 changes: 6 additions & 0 deletions src/core/jacobian/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
add_library(jacobian STATIC
jacobian.cc
)

target_link_libraries(jacobian PUBLIC atm sensor scattering lbl)
target_include_directories(jacobian PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Loading
Loading