Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuang-jedi committed Feb 22, 2024
1 parent cc9af07 commit 4762037
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion make-panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import getopt

import matplotlib as mpl
mpl.rcParams['figure.dpi']= 300
mpl.rcParams['figure.dpi']= 500

#=========================================================================
class MakePanelPlot():
Expand Down
40 changes: 36 additions & 4 deletions plot-sondes.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def plot(self, lons, lats, data):
else:
plt.show()

def plot_obs_marker(self, lons, lats, data, obslon, obslat):
def plot_obs_marker(self, lons, lats, data, obslon, obslat, obsval):
nrows = 1
ncols = 1

Expand Down Expand Up @@ -146,8 +146,40 @@ def plot_obs_marker(self, lons, lats, data, obslon, obslat):
obssize[:] = 10

#adding marks:
axs.scatter(obslon, obslat, color="orangered",
s=obssize, alpha=0.8, transform=proj)
plon = obslon.copy()
plat = obslat.copy()
pval = obsval.copy()
pcol = []
psiz = []

i = 0
for n in range(len(obslon)):
if(not np.isnan(obsval[n])):
plon[i] = obslon[n]
plat[i] = obslat[n]
pval[i] = obsval[n]
if(pval[i] >= 0.0):
pcol.append('red')
psiz.append(int(1 + 10.0*pval[i]))
else:
pcol.append('blue')
psiz.append(int(1 - 10.0*pval[i]))
i += 1

#if(i):
# indices = np.linspace(0, i, i)
# colors = np.sin(indices/float(i))
#else:
# indices = np.linspace(0, 1, 1)
# colors = np.sin(indices/float(1))

#axs.scatter(obslon, obslat, color="orangered",
# s=obssize, alpha=0.8, transform=proj)
axs.scatter(plon[0:i], plat[0:i], color=pcol,
s=psiz, alpha=0.8, transform=proj)

#colors = ["red", "blue", "green"]
#plt.scatter(X, Y, color = colors)

#Adjust the location of the subplots on the page to make room for the colorbar
fig.subplots_adjust(bottom=0.1, top=0.9, left=0.05, right=0.95,
Expand Down Expand Up @@ -308,7 +340,7 @@ def set_runname(self, runname):
gp.set_imagename(imagename)

#gp.plot(lons, lats, data)
gp.plot_obs_marker(lons, lats, data, olon, olat)
gp.plot_obs_marker(lons, lats, data, olon, olat, tomb)

#-----------------------------------------------------------------------------------------
ncfile.close()
Expand Down

0 comments on commit 4762037

Please sign in to comment.