Skip to content

Commit 6c9f031

Browse files
committed
use adcp gridded file for plots if it exists
1 parent 9125a28 commit 6c9f031

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

complete_mission_plots.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import sys
22
import os
3-
import pathlib
43
import logging
5-
6-
script_dir = pathlib.Path(__file__).parent.absolute()
4+
from pathlib import Path
5+
script_dir = Path(__file__).parent.absolute()
76
sys.path.append(str(script_dir))
87
os.chdir(script_dir)
98
from gridded_plots import create_plots, make_map
@@ -17,13 +16,18 @@ def complete_plots(glider, mission):
1716
format='%(asctime)s %(levelname)-8s %(message)s',
1817
level=logging.INFO,
1918
datefmt='%Y-%m-%d %H:%M:%S')
20-
mission_dir = f'/data/data_l0_pyglider/complete_mission/SEA{glider}/M{mission}/gridfiles/'
21-
try:
22-
netcdf = list(pathlib.Path(mission_dir).glob('*.nc'))[0]
23-
except IndexError:
24-
_log.error(f"nc file in {mission_dir} not found")
25-
return
26-
outdir = pathlib.Path(f'/data/plots/complete_mission/SEA{glider}/M{mission}/')
19+
mission_dir = Path(f'/data/data_l0_pyglider/complete_mission/SEA{glider}/M{mission}/gridfiles/')
20+
netcdf = None
21+
for fn in ['gridded_adcp_gliderad2cp.nc', 'gridded_gliderad2cp.nc']:
22+
if (mission_dir / fn).exists():
23+
netcdf = mission_dir / fn
24+
if not netcdf:
25+
try:
26+
netcdf = list(mission_dir.glob('*.nc'))[0]
27+
except IndexError:
28+
_log.error(f"nc file in {mission_dir} not found")
29+
return
30+
outdir = Path(f'/data/plots/complete_mission/SEA{glider}/M{mission}/')
2731
if not outdir.exists():
2832
outdir.mkdir(parents=True)
2933
if 'scatter' in sys.argv:

gridded_plots.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ def sort_by_priority_list(values, priority):
4646
# 'DOWN_IRRADIANCE380',
4747
# 'DOWN_IRRADIANCE490',
4848
# 'DOWN_IRRADIANCE532',
49-
'molar_nitrate'
49+
'molar_nitrate',
50+
'velocity_N_DAC_reference_sb_corrected',
51+
'velocity_E_DAC_reference_sb_corrected',
5052
)
5153

5254
# create dictionary to match each variable in glider_variables to a colourmap
@@ -66,6 +68,8 @@ def sort_by_priority_list(values, priority):
6668
cmap_dict['potential_density'] = cmo.dense
6769
cmap_dict['chlorophyll'] = cmo.algae
6870
cmap_dict['cdom'] = cmo.turbid
71+
cmap_dict['velocity_N_DAC_reference_sb_corrected'] = cmo.balance
72+
cmap_dict['velocity_E_DAC_reference_sb_corrected'] = cmo.balance
6973

7074
labels_dict = {'Celsius': '$^{\\circ}$C',
7175
'None': '',
@@ -75,6 +79,7 @@ def sort_by_priority_list(values, priority):
7579
'μE/m^2/s': 'µE m$^{-1}$ s$^{-1}$',
7680
'1': '',
7781
'kg m-3': 'kg m$^{-3}$',
82+
'm.s-1': 'm s$^{-1}$',
7883
'mmol m-3': 'mmol m$^{-3}$',
7984
'mg m-3': 'mg m$^{-3}$',
8085
'g kg^-1': 'g kg$^{-1}$',
@@ -85,7 +90,9 @@ def sort_by_priority_list(values, priority):
8590
'cdom': 'colored dissolved organic matter',
8691
'potential_density': 'potential density',
8792
'potential_temperature': 'potential temperature',
88-
'absolute_salinity': 'absolute salinity'
93+
'absolute_salinity': 'absolute salinity',
94+
'velocity_E_DAC_reference_sb_corrected': 'Eastward velocity referenced to DAC',
95+
'velocity_N_DAC_reference_sb_corrected': 'Northward velocity referenced to DAC',
8996
}
9097

9198

@@ -267,7 +274,7 @@ def multiplotter(dataset, variables, plots_dir, glider='', mission='', grid=True
267274
days = np.arange(1, 32)
268275
ax.xaxis.set_major_locator(mdates.MonthLocator())
269276
ax.xaxis.set_minor_locator(mdates.DayLocator(days))
270-
ax.xaxis.set_major_formatter(mdates.DateFormatter("\n%b %Y"))
277+
ax.xaxis.set_major_formatter(mdates.DateFormatter("\n %d %b %Y"))
271278
ax.xaxis.set_minor_formatter(mdates.DateFormatter("%d"))
272279
ax.tick_params(axis="x", which="both", length=4)
273280
plt.setp(ax.get_xticklabels(), rotation=0, ha="center")
@@ -366,4 +373,4 @@ def make_map(nc, filename):
366373

367374

368375
if __name__ == '__main__':
369-
create_plots(Path("/data/data_l0_pyglider/nrt/SEA76/M25/gridfiles/mission_grid.nc"), Path("/home/callum/Downloads"), True)
376+
create_plots(Path("/data/data_l0_pyglider/complete_mission/SEA55/M85/gridfiles/gridded_adcp_gliderad2cp.nc"), Path("/home/callum/Downloads"), True)

0 commit comments

Comments
 (0)