-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathazmp_genReport2022.py
More file actions
237 lines (190 loc) · 13.1 KB
/
azmp_genReport2022.py
File metadata and controls
237 lines (190 loc) · 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
'''
For ResDoc and presentation on 2022 conditions.
This script is usuall run into:
/home/cyrf0006/AZMP/state_reports/
with subfolders:
airTemp/
bergs/
bottomT/
CIL/
climate_index/
LC_transport/
SSTs/
and figures further moved here:
2022/
Started Jan. 2023
'''
import os
import matplotlib.pyplot as plt
import numpy as np
#Provide the path to where custom packages are saved
import sys
sys.path.append('/home/jcoyne/Documents/AZMP-NL_python-toolbox/python-toolbox/azmp_modules')
import azmp_sections_tools as azst
import azmp_report_tools as azrt
import azmp_genreport as azgen
import cc_tools as cc
## ---- 2022 update ---- ## [DONE 2022x]
# 1. NAO (should be a function with year as input) [Done 2021]
# in /home/cyrf0006/AZMP/state_reports/airTemp
# previously:
#%my_run azmp_nao.py # had to re-write in 2021
#%my_run azmp_ao.py # had to re-write in 2021
#%my_run azmp_amo.py
# New from 2022:
azgen.nao(2022)
azgen.ao(2022)
azgen.amo(2022)
os.system('cp NAO_winter_1950-2022.png NAO_winter_1950-2022_FR.png ../2022/')
# 2. Air temperature (need to dowload AHCCD and download NUUK update) [DONE 2022x]
%my_run azmp_dmi_nuukAirT.py
%my_run azmp_airTemp.py # use this one since 2020 conditions report
os.system('cp air_temp_2022.png air_temp_2022_FR.png air_temp_anom.png air_temp_anom_FR.png air_temp_climate_index.png air_temp_climate_index_FR.png ../2022/')
%my_run azmp_air_scorecards.py
os.system('cp scorecards_air.png scorecards_air_FR.png ../2022/')
# 3. SSTs [Received from PSG]
# wget -m ftp://ftp.dfo-mpo.gc.ca/bometrics/noaa/stats/boxes/*.stat
# (in /home/cyrf0006/data/BIO_remote/bometrics/noaa/stats/boxes)
#%my_run azmp_SSTs.py # to update bometrics data
#%my_run azmp_SSTs_fromExcel.py # To merge with Eugene's historical Excel data
#os.system('cp SST_index.png ../2022/')
#%my_run azmp_SSTs_scorecards.py # to generate monthly anom, scorecards, etc.
#os.system('cp scorecards_sst_yearly.png scorecards_sst_monthly.png ../2022/')
# 4. Station 27 [Done 2022; but problems with data]
#%my_run viking2022.py # NOT IN 2022
#os.system('cp Viking2022.png Viking2022_FR.png ../2022')
# need to delete /home/cyrf0006/AZMP/state_reports/stn27/stn27_all_casts.nc
os.system('mkdir 2021')
os.system('mkdir stn27')
#Remember, azmp_stn27.py needs to be run twice (temperature and salinity)
os.system('python /home/jcoyne/Documents/AZMP-NL_python-toolbox/python-toolbox/azmp_stn27.py')
os.system('python /home/jcoyne/Documents/AZMP-NL_python-toolbox/python-toolbox/azmp_stn27_density.py')
os.system('python /home/jcoyne/Documents/AZMP-NL_python-toolbox/python-toolbox/azmp_stn27_analysis.py')
os.system('python /home/jcoyne/Documents/AZMP-NL_python-toolbox/python-toolbox/azmp_stn27_scorecards.py')
os.system('cp scorecards_s27.png scorecards_s27_FR.png s27_CIL_subplots.png s27_CIL_subplots_FR.png s27_TS_subplots.png s27_TS_subplotsFR.png s27_mld_monthly.png s27_stratif_monthly_shallow.png s27_stratif_monthly_shallow_FR.png 2021/')
os.system('cp s27_salinity_subplot_2021.png s27_salinity_subplot_2021_FR.png s27_temperature_subplot_2021.png s27_temperature_subplot_2021_FR.png 2021/')
os.system("find ./ -maxdepth 1 -type f | xargs mv -t ./stn27") #move all other files to stn27/
# To prepare MS
#%my_run azmp_stn27_climateindex_ms.py
# 5. Sea Ice (/home/cyrf0006/AZMP/state_reports/ice) [Received from PSG]
#%my_run azmp_ice_index.py
#os.system('cp ice_index.png ice_index_FR.png ../2022/')
# 6. Icebergs (/home/cyrf0006/AZMP/state_reports/bergs) [DONE 2021]
%my_run azmp_bergs.py
os.system('cp bergs_annual_FR.png bergs_annual.png bergs_monthly_FR.png bergs_monthly.png ../2022')
# 7. bottom temperature maps [Done 2022x]
os.system('mkdir bottom_temp')
azrt.bottom_temperature(season='spring', year='2022', climato_file='operation_files/Tbot_climato_spring_0.10.h5', netcdf_path='/home/jcoyne/Documents/CASH/Combined_Data/CASTS_new-vertical_v2/')
azrt.bottom_temperature(season='fall', year='2022', climato_file='operation_files/Tbot_climato_fall_0.10.h5', netcdf_path='/home/jcoyne/Documents/CASH/Combined_Data/CASTS_new-vertical_v2/')
os.system('cp bottomT_spring2022.png bottomT_spring2022_FR.png bottomT_fall2022.png bottomT_fall2022_FR.png 2022')
os.system('mv *.png bottom_temp/')
# For NAFO STACFEN and STACFIS input: [NEED TO DO]
azrt.bottom_temperature(season='summer', year='2022', climato_file='Tbot_climato_SA4_summer_0.10.h5')
# bottom salinity maps [Done 2022x]
os.system('mkdir bottom_saln')
azrt.bottom_salinity(season='spring', year='2022', climato_file='operation_files/Sbot_climato_spring_0.10.h5', netcdf_path='/home/jcoyne/Documents/CASH/Combined_Data/CASTS_new-vertical_v2/')
azrt.bottom_salinity(season='fall', year='2022', climato_file='operation_files/Sbot_climato_fall_0.10.h5', netcdf_path='/home/jcoyne/Documents/CASH/Combined_Data/CASTS_new-vertical_v2/')
os.system('cp bottomS_spring2022.png bottomS_spring2022_FR.png bottomS_fall2022.png bottomS_fall2022_FR.png 2022')
os.system('mv *.png bottom_saln/')
# bottom stats and scorecards (arange year+1)
#[need to flag years if coverage insufficient]
os.system('mkdir bottom_temp_stats')
azrt.bottom_stats(years=np.arange(1980, 2023), season='spring', netcdf_path='/home/jcoyne/Documents/CASH/Combined_Data/CASTS_new-vertical_v2/')
azrt.bottom_stats(years=np.arange(1980, 2023), season='fall', netcdf_path='/home/jcoyne/Documents/CASH/Combined_Data/CASTS_new-vertical_v2/')
#azrt.bottom_stats(years=np.arange(1980, 2023), season='summer')
azrt.bottom_scorecards(years=[1980, 2022], clim_year=[1991, 2020])
os.system('cp scorecards_botT_spring.png scorecards_botT_spring_FR.png scorecards_botT_fall_FR.png scorecards_botT_fall.png 2021')
os.system("find ./ -maxdepth 1 -type f | xargs mv -t ./bottom_temp_stats") #move all other files to bottom_temp_stats/
# For NAFO STACFEN and STACFIS input (for azmp_composite_index.py): [NEED TO DO]
azrt.bottom_stats(years=np.arange(1980, 2022), season='summer', climato_file='Tbot_climato_SA4_summer_0.10.h5')
# bottom temperature bar plots [need to flag years if coverage insufficient]
os.system('python /home/jcoyne/Documents/AZMP-NL_python-toolbox/python-toolbox/azmp_bottomT_mean_anomaly.py')
os.system('cp bottomT_anomalies_climateindex.png bottomT_anomalies_climateindex_FR.png 2021')
os.system("find ./ -maxdepth 1 -type f | xargs mv -t ./bottom_temp_stats") #move all other files to bottom_temp_stats/
## --------------- Sections plots ------------- ## [Done 2022!]
os.system('mkdir AZMP_lines')
year = 2022
sections = ['SI', 'BB', 'FC']
seasons = ['summer']
variables = ['temperature', 'salinity']
for section in sections:
for season in seasons:
for var in variables:
azst.seasonal_section_plot(VAR=var, SECTION=section, SEASON=season, YEAR=year, ZMAX=500, STATION_BASED=True)
plt.close('all')
command = 'montage temperature_' + section + '_' + season + '_' + str(year) + '.png salinity_' + section + '_' + season + '_' + str(year) + '.png -tile 2x1 -geometry +10+10 -background white ' + section + '_stn_' + season + '_' + str(year) + '.png'
os.system(command)
command = 'montage temperature_' + section + '_' + season + '_' + str(year) + '_FR.png salinity_' + section + '_' + season + '_' + str(year) + '_FR.png -tile 2x1 -geometry +10+10 -background white ' + section + '_stn_' + season + '_' + str(year) + '_FR.png'
os.system(command)
os.system('rm temperature*.png salinity*.png')
os.system('cp ' + section + '_stn_' + season + '_' + str(year) + '.png 2021')
os.system('cp ' + section + '_stn_' + season + '_' + str(year) + '_FR.png 2021')
os.system("find ./ -maxdepth 1 -type f | xargs mv -t ./AZMP_lines") #move all other files to AZMP_lines/
# Section CIL [CANNOT UPDATE 2022]
%my_run azmp_CIL_scorecards.py # update year in script!
os.system('rm scorecards_CIL_SI* scorecards_CIL_BB* scorecards_CIL_FC*')
os.system('cp scorecards_CIL.png scorecards_CIL_FR.png ../2022')
%my_run azmp_CIL_mean_anomaly.py # update year in script!
os.system('cp section_CIL_anomaly.png section_CIL_anomaly_FR.png ../2022')
## ----------- NLCI ---------------- ##
%my_run azmp_climate_index.py
## ----------- AZMP SAR / IROC ---------------- ##
#%my_run azmp_CIL_stats.py
%my_run azmp_CIL_stats_update.py # <---- preferred if only an update is needed (need to edit sections)
%my_run azmp_sar_input.py
os.system('cp NL_climate_index_ms_scorecards_FR.png NL_climate_index_ms_scorecards.png NL_climate_index_ms_FR.png NL_climate_index_ms.png ../2022')
## ----------- CSAS DATA ---------------- ##
%my_run csas_crab_stats.py
%my_run azmp_bottomT_habitat.py
#%my_run NSRF_bottomT.py
#%my_run NSRF_bottomS.py
#%my_run NSRF_bottomT_habitat.py
#%my_run azmp_bottomT_shrimp_habitat.py
#azrt.bottom_stats(years=np.arange(1980, 2020), season='summer') # for crab 4R
azrt.bottom_temperature(season='summer', year='2020') # for crab 4R
# SFAs (clim fill is new in 2022) [done 2022]
#azrt.sfa_bottom_stats(years=np.arange(2006, 2023), season='summer', plot=True, climato_file='Tbot_climato_NSRFx_summer_2006-2021.h5')
azrt.sfa_bottom_stats(years=np.arange(2006, 2023), season='summer', climato_file='Tbot_climato_NSRFx_summer_2006-2021.h5', plot=True, clim_fill=True, plot_biomass=True)
os.system('cp sfa_bottomT_2022.png ../../2022')
azrt.sfa_bottom_scorecards(years=np.arange(2006, 2023), clim_year=[2006, 2020])
os.system('cp scorecards_botT_SFA2-4_summer.png scorecards_botT_SFA2-4_summer_FR.png ../../2022')
# salinity (new in 2022)
azrt.sfa_bottom_stats(years=np.arange(2006, 2023), season='summer', climato_file='Sbot_climato_NSRFx_summer_2006-2021.h5', plot=True, clim_fill=True, plot_biomass=True ,var='salinity')
os.system('cp sfa_bottomS_2022.png ../../2022')
azrt.sfa_bottomS_scorecards(years=np.arange(2006, 2023), clim_year=[2006, 2021])
os.system('cp scorecards_botS_SFA2-4_summer.png scorecards_botS_SFA2-4_summer_FR.png ../../2022')
# In ~/research/lobster:
%my_run lfa_sst_extract.py
%my_run lfa_sst_analysis.py
## ----------- OA data for BGC ResDoc ---------------- ##
os.system('cd /home/cyrf0006/AZMP/oa/NL_obs')
years = [2019, 2020]
seasons = ['summer', 'fall']
variables = ['Omega_Aragonite_(unitless)', 'pH_Total_(total_scale)', 'Oxygen_Saturation_(%)', 'Dissolved_Oxygen_(mL/L)']
depth = 'bottom'
for year in years:
print('-> ' + str(year))
for season in seasons:
print(' --> ' + season)
for variable in variables:
print(' ---> ' + variable)
cc.seasonal_map_NL(variable, year, season, depth)
plt.close('all')
# for 2020:
#montage AZMP_OA_2020_summer_OmegaA_surface.png AZMP_OA_2020_summer_pH_surface.png AZMP_OA_2020_summer_DO_perc_surface.png -tile 1x3 -geometry +10+10 -background white AZMP_OA_2020_summer_surface.png
# for 2021:
#montage AZMP_OA_2021_summer_OmegaA_surface.png AZMP_OA_2021_summer_pH_surface.png AZMP_OA_2021_summer_DO_perc_surface.png -tile 1x3 -geometry +10+10 -background white AZMP_OA_2021_summer_surface.png
# Montage 2 years in review:
os.system('montage NL_OA_2019_summer_pH_bottom.png NL_OA_2019_summer_OmegaA_bottom.png NL_OA_2020_summer_pH_bottom.png NL_OA_2020_summer_OmegaA_bottom.png -tile 2x2 -geometry +10+10 -background white NL_OA_summer_2019-2020.png')
os.system('montage NL_OA_2019_summer_pH_bottom.png NL_OA_2019_fall_pH_bottom.png NL_OA_2020_summer_pH_bottom.png NL_OA_2020_fall_pH_bottom.png -tile 2x2 -geometry +10+10 -background white NL_pH_summer-fall_2019-2020.png')
os.system('montage NL_OA_2019_summer_DO_perc_bottom.png NL_OA_2019_fall_DO_perc_bottom.png NL_OA_2020_summer_DO_perc_bottom.png NL_OA_2020_fall_DO_perc_bottom.png -tile 2x2 -geometry +10+10 -background white NL_DO_perc_2019-2020.png')
# Montage for same year summer and fall:
os.system('montage NL_OA_2019_summer_pH_bottom.png NL_OA_2019_fall_pH_bottom.png NL_OA_2019_summer_OmegaA_bottom.png NL_OA_2019_fall_OmegaA_bottom.png -tile 2x2 -geometry +10+10 -background white NL_OA_2019.png')
os.system('montage NL_OA_2020_summer_pH_bottom.png NL_OA_2020_fall_pH_bottom.png NL_OA_2020_summer_OmegaA_bottom.png NL_OA_2020_fall_OmegaA_bottom.png -tile 2x2 -geometry +10+10 -background white NL_OA_2020.png')
# Montage in French:
os.system('montage NL_OA_2019_summer_pH_bottom_FR.png NL_OA_2019_summer_OmegaA_bottom_FR.png NL_OA_2020_summer_pH_bottom_FR.png NL_OA_2020_summer_OmegaA_bottom_FR.png -tile 2x2 -geometry +10+10 -background white NL_OA_summer_2019-2020_FR.png')
os.system('montage NL_OA_2019_summer_pH_bottom_FR.png NL_OA_2019_fall_pH_bottom_FR.png NL_OA_2020_summer_pH_bottom_FR.png NL_OA_2020_fall_pH_bottom_FR.png -tile 2x2 -geometry +10+10 -background white NL_pH_summer-fall_2019-2020_FR.png')
os.system('montage NL_OA_2019_summer_DO_perc_bottom_FR.png NL_OA_2019_fall_DO_perc_bottom_FR.png NL_OA_2020_summer_DO_perc_bottom_FR.png NL_OA_2020_fall_DO_perc_bottom_FR.png -tile 2x2 -geometry +10+10 -background white NL_DO_perc_2019-2020_FR.png')
os.system('montage NL_OA_2019_summer_pH_bottom_FR.png NL_OA_2019_fall_pH_bottom_FR.png NL_OA_2019_summer_OmegaA_bottom_FR.png NL_OA_2019_fall_OmegaA_bottom_FR.png -tile 2x2 -geometry +10+10 -background white NL_OA_2019_FR.png')
os.system('montage NL_OA_2020_summer_pH_bottom_FR.png NL_OA_2020_fall_pH_bottom_FR.png NL_OA_2020_summer_OmegaA_bottom_FR.png NL_OA_2020_fall_OmegaA_bottom_FR.png -tile 2x2 -geometry +10+10 -background white NL_OA_2020_FR.png')