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

parameter interpretation #1

Open
raypenper opened this issue Apr 18, 2022 · 9 comments
Open

parameter interpretation #1

raypenper opened this issue Apr 18, 2022 · 9 comments

Comments

@raypenper
Copy link

Hi Dr.Ferro, what does the four parameters FRAME_START, FRAME_END, METERS_SKIP and SQUINT_ANGLE mean? Do we need to change their values when simulating different EDR or RDR products?

@adamoferro
Copy link
Owner

adamoferro commented Apr 20, 2022 via email

@raypenper
Copy link
Author

Thanks for your reply ^_^
When I intended to plot the simulation result using the function SimulationPlot, an error occurred. I checked the saved simulation result and found that the values in it are all zeros. Could you please tell me why?

image

@adamoferro
Copy link
Owner

adamoferro commented Apr 23, 2022 via email

@raypenper
Copy link
Author

raypenper commented Apr 24, 2022

Sorry that I did not make it clear. I used SHARAD EDR data of south polar region for input. The whole command lines in the main function are as follows:

MOLA128_FILENAME_BASE = "I:/MarsData/MOLA/megt_s_128_1/megt_s_128_1.img"

EDR_PDS_INPUT_FILENAME_BASE = "I:/MarsData/SHARAD/edr/e_0598301_001_ss19_700_a"  # OBS folder path+base file name (without suffixes)
EDR_PDS_INPUT_DATASET_NAME = "edr0598301"
EDR_PDS_OUTPUT_SIM_FILENAME_BASE = "I:/projects/sopa-SHARADlowlevelProcessing/output/PDS-EDR-0598301_SIM.img"
EDR_PDS_OUTPUT_FOC_FILENAME_BASE = "I:/projects/sopa-SHARADlowlevelProcessing/output/PDS-EDR-0598301_FOC.img"

FRAME_START = 1000
FRAME_END = 20000
METERS_SKIP = 450
FRAME_HALF_APERTURE = 758  # use 758 for "standard" focusing with presumming = 4
SQUINT_ANGLE = 20

lg = logger(verbose=True)

# create SHARAD instrument instance
i = SHARAD()

# Mars ellipsoid characteristics
cc = MARS_IAU2000()

# the MOLA128 radius data are contained in a single ENVI file
m = MOLA128(filename_base=MOLA128_FILENAME_BASE)  # mola_mars_data.hdr
m.read()

# definition of focuser and simulator parameters
pars = FocuserParameters(frame_start=FRAME_START, frame_end=FRAME_END, meters_skip=METERS_SKIP,
                         frame_half_aperture=FRAME_HALF_APERTURE, squint_angle=SQUINT_ANGLE)

# definition of a square facets RS simulator using the Mars coordinate converter and the MOLA128 DEM
s = sfRSsim(geom_obj=cc, dem_obj=m, param_obj=pars,
            n_processes=6)  # simulation parameters are contained in the DRSSim class

# ...or dRSsim:
# s = dRSsim(geom_obj=cc, dem_obj=m, param_obj=pars, n_processes=6)       # simulation parameters are contained in the DRSSim class

# EDR PDS
fn_base = EDR_PDS_INPUT_FILENAME_BASE
d = EDR_PDS(dataset_name=EDR_PDS_INPUT_DATASET_NAME, filename_base=fn_base, logger=lg)
d.load(mode="full")
d.generate_orbit_data()
if d.orbit_data is not None:

    # plot the track path on the DEM
    # tpod = TrackPlotOnDEM(m, d.orbit_data["Lat"], d.orbit_data["Lon"], title="Spacecraft ground track on DEM (full track)")
    # tpod.plot()

    # simulate surface clutter radargram
    sim_image, uncert_image, first_return_lats, first_return_lons, ground_distance_min_image, ground_distance_max_image = s.simulate(
        d.orbit_data)

    # save results on disk
    envi.write(EDR_PDS_OUTPUT_SIM_FILENAME_BASE, sim_image)
    envi.write(EDR_PDS_OUTPUT_SIM_FILENAME_BASE + "_uncert", uncert_image)

    # plot the simulated radargram
    # only the top part of the simulation is shown (the top point is calculated dinamically)
    top_point = np.min(np.argmin(np.isnan(ground_distance_min_image).astype(int), axis=0)) - 50
    bottom_point = top_point + 1000
    sp = SimulationPlot(sim_image, top_point=top_point, bottom_point=bottom_point,
                        title="Radargram simulation with sfRSsim\n(square facets and cos^exp function)")
    sp.plot()

    # plot the track path and the location of the first simulated returns on the DEM
    tfrpod = TrackAndFirstReturnsPlotOnDEM(m, d.orbit_data["Lat"], d.orbit_data["Lon"], first_return_lats,
                                           first_return_lons)
    tfrpod.plot()

    # plot the image showing the minimum ground distance from nadir of each simulated range sample
    gdp = GroundDistancePlot(ground_distance_min_image / 1000., top_point=top_point, bottom_point=bottom_point,
                             title="Distance [km] of the closest facet contributing\nto each radargram sample simulation")
    gdp.plot()

    # get the DEM radius profile related to the spacecraft track, to be used later by the focuser
    dem_radius_profile = m.get_dem_radius_from_lat_lon(d.orbit_data["Lat"], d.orbit_data["Lon"])

    # free the memory occupied by the DEM (not mandatory, but it may be useful if system RAM is limited)
    del m

    if d.data is not None:
        # create a SOFA instance and focus the input radargram
        f = SOFA(i, cc, dem_radius_profile, d, pars, n_processes=4, debug_mode=True)
        focused_rdr = f.focus()
        if focused_rdr is not None:
            envi.write(EDR_PDS_OUTPUT_FOC_FILENAME_BASE + "_ha-" + str(pars.frame_half_aperture) + "_s-" + str(
                pars.squint_angle), focused_rdr)

            # plot the focused radargram
            rp = RadargramPlot(focused_rdr, top_point=top_point, bottom_point=bottom_point, title="Radargram")
            rp.plot()

@adamoferro
Copy link
Owner

adamoferro commented Apr 25, 2022 via email

@raypenper
Copy link
Author

The megt_s_128_1.img file is a topographic map of the south pole of Mars at a resolution of 128 pixels per degree from https://pds-geosciences.wustl.edu
When I changed the input as megr_n_128.img radius file. It still did not work.
now the error has become:
image

@adamoferro
Copy link
Owner

adamoferro commented Apr 30, 2022 via email

@raypenper
Copy link
Author

Hi there!
Thank you for the detailed explanation and sharing! It is of great help!

All the best,
Peng

@adamoferro
Copy link
Owner

adamoferro commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants