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

Longitude on Displays #117

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
13 changes: 12 additions & 1 deletion calipso/plot/plot_backscattered.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import ccplot.utils

import matplotlib as mpl
#import matplotlib.pyplot as plt #KDM
import numpy as np


Expand All @@ -37,6 +38,7 @@ def render_backscattered(filename, x_range, y_range, fig, pfig):
height = product['metadata']['Lidar_Data_Altitudes']
dataset = product['Total_Attenuated_Backscatter_532'][x1:x2]
latitude = product['Latitude'][x1:x2, 0]
longitude = product['Longitude'][x1:x2, 0]

time = np.array([ccplot.utils.calipso_time2dt(t) for t in time])
dataset = np.ma.masked_equal(dataset, -9999)
Expand Down Expand Up @@ -84,7 +86,16 @@ def render_backscattered(filename, x_range, y_range, fig, pfig):
ax.set_xlabel('Time')
ax.set_xlim(time[0], time[-1])
ax.get_xaxis().set_major_formatter(mpl.dates.DateFormatter('%H:%M:%S'))


# KDM - added longitude axis below
long_ax = fig.twiny()
long_ax.xaxis.set_ticks_position('bottom')
long_ax.xaxis.set_label_position('bottom')
long_ax.spines['bottom'].set_position(('outward', 40))
long_ax.set_xlim(longitude[0], longitude[-1])
long_ax.set_xlabel('Longitude')


fig.set_zorder(0)
ax.set_zorder(1)

Expand Down
24 changes: 13 additions & 11 deletions calipso/plot/plot_depolar_ratio.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def render_depolarized(filename, x_range, y_range, fig, pfig):
minimum = min(product['Profile_UTC_Time'][::])[0]
maximum = max(product['Profile_UTC_Time'][::])[0]
latitude = product['Latitude'][x1:x2, 0]
longitude = product['Longitude'][x1:x2, 0]

# length of time determines how far the file can be viewed
if time[-1] >= maximum and len(time) < 950:
Expand Down Expand Up @@ -81,29 +82,30 @@ def render_depolarized(filename, x_range, y_range, fig, pfig):

im = fig.imshow(
regrid_depolar_ratio,
extent=(mpl.dates.date2num(time[0]), mpl.dates.date2num(time[-1]), h1, h2),
extent=(latitude[0], latitude[-1], h1, h2),
cmap=cm,
norm=norm,
aspect='auto',
interpolation='nearest',
)

fig.set_ylabel('Altitute (km)')
fig.set_xlabel('Time')
fig.get_xaxis().set_major_locator(mpl.dates.AutoDateLocator())
fig.get_xaxis().set_major_formatter(mpl.dates.DateFormatter('%H:%M:%S'))

# granule = "%sZ%s" % extractDatetime(filename)
# title = 'Depolarized Ratio for granule %s' % granule
# fig.set_title(title)

fig.set_xlabel('Latitude')
cbar_label = 'Depolarized Ratio 532nm (km$^{-1}$ sr$^{-1}$)'
cbar = pfig.colorbar(im)
cbar.set_label(cbar_label)

ax = fig.twiny()
ax.set_xlabel('Latitude')
ax.set_xlim(latitude[0], latitude[-1])
ax.set_xlabel('Time')
ax.set_xlim(time[0], time[-1])
ax.get_xaxis().set_major_formatter(mpl.dates.DateFormatter('%H:%M:%S'))

long_ax = fig.twiny()
long_ax.xaxis.set_ticks_position('bottom')
long_ax.xaxis.set_label_position('bottom')
long_ax.spines['bottom'].set_position(('outward', 40))
long_ax.set_xlim(longitude[0], longitude[-1])
long_ax.set_xlabel('Longitude')

fig.set_zorder(1)
ax.set_zorder(0)
Expand Down