Skip to content

Commit

Permalink
Adjusted some parameters for generating the shaded and surf images to…
Browse files Browse the repository at this point in the history
… try to fix the 'flashing' problem that I started noticing on runs.
  • Loading branch information
daminton committed Oct 21, 2022
1 parent 300550f commit 35fad7b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions python/ctem/ctem/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def __init__(self, param_file="ctem.in", isnew=True):
'gridsize': -1,
'seed': 0,
'maxcrat': 1.0,
'shadedminhdefault': 1,
'shadedmaxhdefault': 1,
'shadedminhdefault': 0,
'shadedmaxhdefault': 0,
'shadedminh': 0.0,
'shadedmaxh': 0.0,
'workingdir': currentdir,
Expand Down Expand Up @@ -305,4 +305,4 @@ def cleanup(self):

if __name__ == '__main__':
sim = Simulation()
sim.run()
sim.run()
15 changes: 10 additions & 5 deletions python/ctem/ctem/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def create_rplot(user, odist, pdist, tdist, ph1):
plt.tick_params(axis='both', which='minor', labelsize=12)

plt.savefig(filename)
plt.close()

return

Expand All @@ -130,7 +131,7 @@ def image_dem(user, DEM):
gridsize = user['gridsize']
ve = 1.0
azimuth = 300.0 # user['azimuth']
solar_angle = 20.0 # user['solar_angle']
solar_angle = 15.0 # user['solar_angle']

ls = LightSource(azdeg=azimuth, altdeg=solar_angle)
dem_img = ls.hillshade(DEM, vert_exag=ve, dx=pix, dy=pix)
Expand All @@ -145,6 +146,7 @@ def image_dem(user, DEM):
# Save image to file
filename = os.path.join(user['workingdir'],'surf',"surf%06d.png" % user['ncount'])
plt.savefig(filename, dpi=dpi, bbox_inches=0)
plt.close()

return

Expand All @@ -168,6 +170,7 @@ def image_regolith(user, regolith):
fig = plt.figure(figsize=(width, height), dpi=dpi)
fig.figimage(regolith_scaled, cmap=cm.nipy_spectral, origin='lower')
plt.savefig(filename)
plt.close()

return

Expand All @@ -177,13 +180,13 @@ def image_shaded_relief(user, DEM):
pix = user['pix']
gridsize = user['gridsize']
ve = 1.0
mode = 'overlay'
mode = 'hsv'
azimuth = 300.0 # user['azimuth']
solar_angle = 20.0 # user['solar_angle']
solar_angle = 15.0 # user['solar_angle']

ls = LightSource(azdeg=azimuth, altdeg=solar_angle)
cmap = cm.cividis

# If min and max appear to be reversed, then fix them
if (user['shadedminh'] > user['shadedmaxh']):
temp = user['shadedminh']
Expand All @@ -192,7 +195,7 @@ def image_shaded_relief(user, DEM):
else:
user['shadedminh'] = user['shadedminh']
user['shadedmaxh'] = user['shadedmaxh']

# If no shadedmin/max user are read in from ctem.dat, determine the values from the data
if (user['shadedminhdefault'] == 1):
shadedminh = np.amin(DEM)
Expand All @@ -217,6 +220,8 @@ def image_shaded_relief(user, DEM):
# Save image to file
filename = os.path.join(user['workingdir'],'shaded',"shaded%06d.png" % user['ncount'])
plt.savefig(filename, dpi=dpi, bbox_inches=0)
plt.close()

return user


Expand Down

0 comments on commit 35fad7b

Please sign in to comment.