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

V2.6.x addsungeo #770

Merged
merged 3 commits into from
Jun 12, 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
36 changes: 36 additions & 0 deletions src/m_sun.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,42 @@ void sunsAddSingleFromGridAtLocation(

}

void sunsChangeGeometry(ArrayOfSun &suns,
// Inputs:
const Numeric &radius,
const Numeric &distance,
const Numeric &latitude,
const Numeric &longitude,
const Index &sun_index,
const Verbosity &)
{
if (sun_index == -999) return;

ARTS_USER_ERROR_IF(sun_index+1 > suns.nelem(),
"The sun index ", sun_index, " is out of range. \n"
"The sun array has only ", suns.nelem(), " elements.")

if (radius > 0) suns[sun_index].radius = radius;
if (distance > 0) suns[sun_index].distance = distance;

//some sanity checks
ARTS_USER_ERROR_IF(distance<radius,
"The distance to the center of the sun (", distance, " m) \n"
" is smaller than the radius of the sun (", radius, " m )")

ARTS_USER_ERROR_IF(latitude < -90 || latitude > 90,
"The latitude of the sun should be between -90 and 90 degrees,\n"
"but is ", latitude, " degrees")

ARTS_USER_ERROR_IF(longitude < -180 || longitude > 360,
"The longitude of the sun should be between -180 and 360 degrees,\n"
"but is ", longitude, " degrees")


suns[sun_index].latitude = latitude;
suns[sun_index].longitude = longitude;
}

void sunsOff(Index &suns_do,
ArrayOfSun &suns,
const Verbosity &){
Expand Down
24 changes: 23 additions & 1 deletion src/methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19770,7 +19770,29 @@ where N>=0 and the species name is something line "H2O".
"The description of the sun. ",
"The latitude of the sun spectrum measurement. ",
"The longitude of the sun spectrum measurement. ",
"The altitude of the sun spectrum measurement. ")));
"The altitude of the sun spectrum measurement. ")));

md_data_raw.push_back(create_mdrecord(
NAME("sunsChangeGeometry"),
DESCRIPTION(
"Change the geometry of desired sun\n"),
AUTHORS("Manfred Brath"),
OUT("suns"),
GOUT(),
GOUT_TYPE(),
GOUT_DESC(),
IN(),
GIN("radius","distance","latitude","longitude","index"),
GIN_TYPE("Numeric","Numeric","Numeric","Numeric","Index"),
GIN_DEFAULT("-999","-999","-999","-999","-999"),
GIN_DESC("The radius of the sun in meter. If set to -999, it is not changed",
"Distance from center of the planet to center of the sun in meter."
"If set to -999, it is not changed",
"Latitude of the zenith position of the sun. Must be between -90 and 90."
"If set to -999, it is not changed",
"Longitude of the zenith position of the sun. Must be between -180 and 360."
"If set to -999, it is not changed",
"The index of the sun to change. If set to -999 nothing is changed")));

md_data_raw.push_back(create_mdrecord(
NAME("sunsOff"),
Expand Down