Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- ##
- coding: utf - 8# In[2]: ##Library 로드하기
- import os
- import pandas as pd
- import numpy as np
- import sys
- import matplotlib.pyplot as plt from dplython
- import * #(
- DplyFrame,
- X,
- diamonds,
- select,
- sift,
- sample_n, #sample_frac,
- head,
- arrange,
- mutate,
- group_by,
- summarize,
- DelayFunction
- ) from scipy.stats
- import linregress from matplotlib
- import pyplot as plt from IPython.display
- import Image from mpl_toolkits.basemap
- import Basemap from matplotlib.colors
- import Normalize
- import matplotlib
- import matplotlib.cm as cm
- import seaborn as sns from scipy.stats
- import linregress from matplotlib
- import rcParams from netCDF4
- import Dataset
- import struct
- import binascii from mpl_toolkits.basemap
- import addcyclic from mpl_toolkits.basemap
- import shiftgrid from netCDF4
- import num2date,
- date2num,
- date2index
- import datetime from pyhdf.SD
- import SD,
- SDC
- import h5py
- import timeit from datetime
- import datetime from colormap
- import rgb2hex from matplotlib
- .colors
- import LinearSegmentedColormap from matplotlib
- import rc from mpl_toolkits
- .axes_grid1
- import make_axes_locatable
- import matplotlib
- .patches as patches from scipy
- .ndimage
- .filters
- import gaussian_filter from matplotlib
- .collections
- import PatchCollection from matplotlib
- .patches
- import Polygon
- import matplotlib
- .pyplot as plt from matplotlib
- .patches
- import PathPatch
- import shapefile# MATPLOTLIB 경고 무시
- import warnings warnings
- .filterwarnings("ignore") import gc gc
- .enable()# In[3]: #파일 인포 보기 start = timeit
- .default_timer() path = "D:/ocean_model_out/mohid_hydr"
- os
- .chdir(path) os
- .getcwd() ncfile_p = 'BS_MOHID_HYDR_2019021800.nc'
- ncfile = Dataset(ncfile_p) print(
- ncfile
- ) print(ncfile.variables.keys()) nc_value = ncfile
- .variables
- .keys()# In[4]: #모든 값 추출하기 lon = ncfile
- .variables[u 'lon'][: ] lat = ncfile
- .variables[u 'lat'][: ] time = ncfile
- .variables[u 'time'][: ] print('a') lat_staggered = ncfile
- .variables[u 'lat_staggered'][: ] lon_staggered = ncfile
- .variables[u 'lon_staggered'][: ] print('b') bathymetry = ncfile
- .variables[u 'bathymetry'][: ] mask = ncfile
- .variables[u 'mask'][: ] ssh = ncfile
- .variables[u 'ssh'][: ]# In[5]: #print('a')# lat_staggered = ncfile
- .variables[u 'lat_staggered'][: ]# lon_staggered = ncfile
- .variables[u 'lon_staggered'][: ]# print('b')# bathymetry = ncfile
- .variables[u 'bathymetry'][: ]# mask = ncfile
- .variables[u 'mask'][: ]# ssh = ncfile
- .variables[u 'ssh'][: ]# print('c')# U = ncfile
- .variables[u 'u'][: ]# V = ncfile
- .variables[u 'v'][: ]# VM = ncfile
- .variables[u 'vm'][: ]# print('d')# salinity = ncfile
- .variables[u 'salinity'][: ]# temperature = ncfile
- .variables[u 'temperature'][: ]# print('e')# mask_OpenPoints = ncfile
- .variables[u 'mask_OpenPoints'][: ]# print('f')# stop = timeit
- .default_timer()# print(stop - start)# In[6]: BS1_DIR = "D:/ocean_model_out/wave_ko/shpfile/BS_1Poly"
- BS1_FILE = "BS_1Poly"
- BS2_DIR = "D:/ocean_model_out/wave_ko/shpfile/BS_2Poly"
- BS2_FILE = "BS_2Poly"
- BS3_DIR = "D:/ocean_model_out/wave_ko/shpfile/BS_3Poly"
- BS3_FILE = "BS_3Poly"
- BS4_DIR = "D:/ocean_model_out/wave_ko/shpfile/BS_4Poly"
- BS4_FILE = "BS_4Poly"
- BSPOLY_DIR = "D:/ocean_model_out/wave_ko/shpfile/BSPoly"
- BSPOLY_FILE = "BSPoly"
- JPPOLY_DIR = "D:/ocean_model_out/wave_ko/shpfile/JPPoly"
- JPPOLY_FILE = "JPPoly"#
- In[7]: #;
- -- -- -- -- - Domain Setting-- -- -- - start - ::BS 1# bs = 0;
- 4;
- boundary space# Ls = bs + 110;
- bs + 0;
- lat start# Ms = bs + 1;
- bs + 0;
- lon start# Lm = Ls + 213;
- Lm - bs;
- lat end# Mm = Ms + 240;
- Mm - bs;
- lon end#;
- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --end - #lat = 660 lon = 836################### BS######################### minlon = min(
- lon
- ) maxlon = max(lon) minlat = min(lat) maxlat = max(lat)################### BS1######################## bs1 = 0 #4;
- boundary space Ls1 = bs1 + 110#;
- bs + 0;
- lat start Ms1 = bs1 + 1#;
- bs + 0;
- lon start Lm1 = Ls1 + 213#;
- Lm - bs;
- lat end Mm1 = Ms1 + 240#;
- Mm - bs;
- lon end################### BS2######################## bs2 = 0 #4;
- boundary space Ls2 = bs2 + 210#;
- bs + 0;
- lat start Ms2 = bs2 + 165#;
- bs + 0;
- lon start Lm2 = Ls2 + 200#;
- Lm - bs;
- lat end Mm2 = Ms2 + 240#;
- Mm - bs;
- lon end################### BS3######################## bs3 = 0 #4;
- boundary space Ls3 = bs3 + 335#;
- bs + 0;
- lat start Ms3 = bs3 + 220#;
- bs + 0;
- lon start Lm3 = Ls3 + 210#;
- Lm - bs;
- lat end Mm3 = Ms3 + 240#;
- Mm - bs;
- lon end################### BS4######################## bs4 = 0 #4;
- boundary space Ls4 = bs4 + 440#;
- bs + 0;
- lat start Ms4 = bs4 + 220#;
- bs + 0;
- lon start Lm4 = Ls4 + 219#;
- Lm - bs;
- lat end Mm4 = Ms4 + 300#;
- Mm - bs;
- lon end print(Ls1, Lm1, Ms1, Mm1) print(Ls2, Lm2, Ms2, Mm2) print(
- Ls3,
- Lm3,
- Ms3,
- Mm3
- ) print(Ls4, Lm4, Ms4, Mm4) MINLON_BS = min(lon) MAXLON_BS = max(lon) MINLAT_BS = min(
- lat
- ) MAXLAT_BS = max(lat) MINLON_BS1 = lon[Ms1] MAXLON_BS1 = lon[Mm1] MINLAT_BS1 = lat[Ls1] MAXLAT_BS1 = lat[Lm1] MINLON_BS2 = lon[Ms2] MAXLON_BS2 = lon[Mm2] MINLAT_BS2 = lat[Ls2] MAXLAT_BS2 = lat[Lm2] MINLON_BS3 = lon[Ms3] MAXLON_BS3 = lon[Mm3] MINLAT_BS3 = lat[Ls3] MAXLAT_BS3 = lat[Lm3] MINLON_BS4 = lon[Ms4] MAXLON_BS4 = lon[Mm4] MINLAT_BS4 = lat[Ls4] MAXLAT_BS4 = lat[Lm4]# In[8]: bsmap = Basemap(
- projection = 'merc',
- lon_0 = (MINLON_BS + MAXLON_BS) / 2.0,
- lat_0 = (MINLAT_BS + MAXLAT_BS) / 2.0,
- llcrnrlon = MINLON_BS,
- llcrnrlat = MINLAT_BS,
- urcrnrlon = MAXLON_BS,
- urcrnrlat = MAXLAT_BS,
- resolution = 'c'
- ) bsmap1 = Basemap(
- projection = 'merc',
- lon_0 = (MINLON_BS1 + MAXLON_BS1) / 2.0,
- lat_0 = (MINLAT_BS1 + MAXLAT_BS1) / 2.0,
- llcrnrlon = MINLON_BS1,
- llcrnrlat = MINLAT_BS1,
- urcrnrlon = MAXLON_BS1,
- urcrnrlat = MAXLAT_BS1,
- resolution = 'c'
- ) bsmap2 = Basemap(
- projection = 'merc',
- lon_0 = (MINLON_BS2 + MAXLON_BS2) / 2.0,
- lat_0 = (MINLAT_BS2 + MAXLAT_BS2) / 2.0,
- llcrnrlon = MINLON_BS2,
- llcrnrlat = MINLAT_BS2,
- urcrnrlon = MAXLON_BS2,
- urcrnrlat = MAXLAT_BS2,
- resolution = 'c'
- ) bsmap3 = Basemap(
- projection = 'merc',
- lon_0 = (MINLON_BS3 + MAXLON_BS3) / 2.0,
- lat_0 = (MINLAT_BS3 + MAXLAT_BS3) / 2.0,
- llcrnrlon = MINLON_BS3,
- llcrnrlat = MINLAT_BS3,
- urcrnrlon = MAXLON_BS3,
- urcrnrlat = MAXLAT_BS3,
- resolution = 'c'
- ) bsmap4 = Basemap(
- projection = 'merc',
- lon_0 = (MINLON_BS4 + MAXLON_BS4) / 2.0,
- lat_0 = (MINLAT_BS4 + MAXLAT_BS4) / 2.0,
- llcrnrlon = MINLON_BS4,
- llcrnrlat = MINLAT_BS4,
- urcrnrlon = MAXLON_BS4,
- urcrnrlat = MAXLAT_BS4,
- resolution = 'c'
- ) bsmap
- .readshapefile(BSPOLY_DIR, BSPOLY_FILE) bsmap1
- .readshapefile(BS1_DIR, BS1_FILE) bsmap2
- .readshapefile(BS2_DIR, BS2_FILE) bsmap3
- .readshapefile(BS3_DIR, BS3_FILE) bsmap4
- .readshapefile(BS4_DIR, BS4_FILE) bsmap
- .readshapefile(JPPOLY_DIR, JPPOLY_FILE) bsmap1
- .readshapefile(JPPOLY_DIR, JPPOLY_FILE) bsmap2
- .readshapefile(JPPOLY_DIR, JPPOLY_FILE) bsmap3
- .readshapefile(JPPOLY_DIR, JPPOLY_FILE) bsmap4
- .readshapefile(JPPOLY_DIR, JPPOLY_FILE)# In[9]: lon2D,
- lat2D = np.meshgrid(lon, lat) BS_X,
- BS_Y = bsmap(lon2D, lat2D) BS1_X,
- BS1_Y = bsmap1(lon2D, lat2D) BS2_X,
- BS2_Y = bsmap2(lon2D, lat2D) BS3_X,
- BS3_Y = bsmap3(lon2D, lat2D) BS4_X,
- BS4_Y = bsmap4(lon2D, lat2D)# In[10]: ##bln 파일 로드 blnFilePath1 = "D:/ocean_model_out/mohid_hydr/blue-line.bln"
- blnFilePath2 = "D:/ocean_model_out/mohid_hydr/deasan-habor-line.bln"
- blnFilePath3 = "D:/ocean_model_out/mohid_hydr/green-line.bln"
- blnFilePath4 = "D:/ocean_model_out/mohid_hydr/inchon-habor-line.bln"
- blnFilePath5 = "D:/ocean_model_out/mohid_hydr/KMA-habor-line.bln"
- blnFilePath6 = "D:/ocean_model_out/mohid_hydr/red-line.bln"
- blue_line = pd.read_csv(
- blnFilePath1,
- sep = '\s+',
- header = None
- ) deasan_habor_line = pd.read_csv(blnFilePath2, sep = '\s+', header = None) green_line = pd.read_csv(
- blnFilePath3,
- sep = '\s+',
- header = None
- ) inchon_habor_line = pd.read_csv(blnFilePath4, sep = '\s+', header = None) KMA_habor_line = pd.read_csv(
- blnFilePath5,
- sep = '\s+',
- header = None
- ) red_line = pd.read_csv(blnFilePath6, sep = '\s+', header = None) blue_linex = [
- []
- for i in range(0, 1000)
- ] blue_liney = [
- []
- for i in range(0, 1000)
- ] deasan_habor_linex = [
- []
- for i in range(0, 1000)
- ] deasan_habor_liney = [
- []
- for i in range(0, 1000)
- ] green_linex = [
- []
- for i in range(0, 1000)
- ] green_liney = [
- []
- for i in range(0, 1000)
- ] inchon_habor_linex = [
- []
- for i in range(0, 1000)
- ] inchon_habor_liney = [
- []
- for i in range(0, 1000)
- ] KMA_habor_linex = [
- []
- for i in range(0, 1000)
- ] KMA_habor_liney = [
- []
- for i in range(0, 1000)
- ] blue_linex = [
- []
- for i in range(0, 1000)
- ] blue_liney = [
- []
- for i in range(0, 1000)
- ] red_linex = [
- []
- for i in range(0, 1000)
- ] red_liney = [
- []
- for i in range(0, 1000)
- ] count_blue = 0
- for i in range(0, len(blue_line)): if (((blue_line[0][i] - blue_line[1][i]) % 1) != 0): blue_linex[count_blue].append(
- blue_line[0][i]
- ) blue_liney[count_blue].append(blue_line[1][i])
- else :count_blue += 1;
- count = 0
- for i in range(0, len(deasan_habor_line)): if (((deasan_habor_line[0][i] - deasan_habor_line[1][i]) % 1) != 0): deasan_habor_linex[count].append(
- deasan_habor_line[0][i]
- ) deasan_habor_liney[count].append(deasan_habor_line[1][i])
- else :count += 1;
- count_green = 0
- for i in range(0, len(green_line)): if (((green_line[0][i] - green_line[1][i]) % 1) != 0): green_linex[count_green].append(
- green_line[0][i]
- ) green_liney[count_green].append(green_line[1][i])
- else :count_green += 1;
- count = 0
- for i in range(0, len(inchon_habor_line)): if (((inchon_habor_line[0][i] - inchon_habor_line[1][i]) % 1) != 0): inchon_habor_linex[count].append(
- inchon_habor_line[0][i]
- ) inchon_habor_liney[count].append(inchon_habor_line[1][i])
- else :count += 1;
- count = 0
- for i in range(0, len(KMA_habor_line)): if (((KMA_habor_line[0][i] - KMA_habor_line[1][i]) % 1) != 0): KMA_habor_linex[count].append(
- KMA_habor_line[0][i]
- ) KMA_habor_liney[count].append(KMA_habor_line[1][i])
- else :count += 1;
- count_red = 0
- for i in range(0, len(red_line)): if (((red_line[0][i] - red_line[1][i]) % 1) != 0): red_linex[count_red].append(
- red_line[0][i]
- ) red_liney[count_red].append(red_line[1][i])
- else :count_red += 1;#
- In[15]: #[18, 16, 15, 13, 12]# Depth 값에 따른 마스크 setting 하기..##이것은 구조화를 위한 코드...bathymetry_0m_point = np.where(
- bathymetry > 0,
- 1.0,
- -999.0
- ) bathymetry_10m_point = np.where(bathymetry > 10, 1.0, -999.0) bathymetry_25m_point = np.where(
- bathymetry > 25,
- 1.0,
- -999.0
- ) bathymetry_50m_point = np.where(bathymetry > 50, 1.0, -999.0) bathymetry_75m_point = np.where(
- bathymetry > 75,
- 1.0,
- -999.0
- )# def clean_memory(): #del varU# del varV# del varVM# del
- var# del Q##
- return (
- 0
- ) def
- switch (value, index): if (index == 18): value = value * bathymetry_0m_point elif(
- index == 16
- ): value = value * bathymetry_10m_point elif(index == 15): value = value * bathymetry_25m_point elif(
- index == 13
- ): value = value * bathymetry_50m_point elif(index == 12): value = value * bathymetry_75m_point
- else :print(
- "인덱스에 없는 value입니다. 처음의 value 값이 반환되었습니다."
- ) return (value)# shp 파일 색칠하는 함수들..def BSPOLY(map_object): patches = []
- for info, shape in zip(map_object.BSPoly_info, map_object.BSPoly): patches.append(Polygon(np.array(shape), True)) return (patches) def BSPOLY1(map_object): patches = []
- for info, shape in zip(map_object.BS_1Poly_info, map_object.BS_1Poly): patches.append(Polygon(np.array(shape), True)) return (patches) def BSPOLY2(map_object): patches = []
- for info, shape in zip(map_object.BS_2Poly_info, map_object.BS_2Poly): patches.append(Polygon(np.array(shape), True)) return (patches) def BSPOLY3(map_object): patches = []
- for info, shape in zip(map_object.BS_3Poly_info, map_object.BS_3Poly): patches.append(Polygon(np.array(shape), True)) return (patches) def BSPOLY4(map_object): patches = []
- for info, shape in zip(map_object.BS_4Poly_info, map_object.BS_4Poly): patches.append(Polygon(np.array(shape), True)) return (patches) def JPPOLY(map_object): patches = []
- for info, shape in zip(map_object.JPPoly_info, map_object.JPPoly): patches.append(Polygon(np.array(shape), True)) return (patches) def greenline(map_object): for line in range(0, count_green, 1): #print(line) aa, bb = map_object(green_linex[line][: ], green_liney[line][: ]) plt.plot(aa, bb, color = 'green') return (0) def redline(map_object): for line in range(0, count_red, 1): #print(line) aa, bb = map_object(red_linex[line][: ], red_liney[line][: ]) plt.plot(aa, bb, color = 'red') return (0) def blueline(map_object): for line in range(0, count_blue, 1): #print(line) aa, bb = map_object(blue_linex[line][: ], blue_liney[line][: ]) plt.plot(aa, bb, color = 'blue') return (0)# In[11]: #시간 추출(UTC and KST) wet = 1104537600# start time = 2005 / 01 / 01 / 00 / 00 / 00 UTC print(lat.shape, lon.shape) print(time) timelen = len(time) times = [0] * timelen local_dt = [0] * timelen print(times) for i in range(0, timelen): times[i] = datetime.utcfromtimestamp(
- time[int(i)] + wet
- ).strftime('%Y-%m-%d %H')# to UTC local_dt[i] = datetime.fromtimestamp(
- time[int(i)] + wet
- ).strftime('%Y-%m-%d %H')# to KST print(times) print(local_dt)# In[12]: #ncl color table## 컬러바 만들기 color_table = [
- [
- 235, 255, 255, 1
- ],
- [
- 229, 255, 255
- ],
- [
- 211, 255, 255
- ],
- [
- 193, 255, 255
- ],
- [
- 175, 243, 255
- ],
- [
- 164, 225, 255
- ],
- [
- 157, 207, 255
- ],
- [
- 255, 255, 180
- ],
- [
- 255, 255, 160
- ],
- [
- 255, 255, 140
- ],
- [
- 255, 255, 120
- ],
- [
- 255, 255, 100
- ],
- [
- 255, 255, 50
- ],
- [
- 255, 255, 0
- ],
- [
- 255, 202, 108
- ],
- [
- 255, 184, 90
- ],
- [
- 255, 166, 72
- ],
- [
- 255, 148, 54
- ],
- [
- 255, 130, 36
- ],
- [
- 255, 112, 18
- ],
- [
- 255, 110, 0
- ],
- [
- 237, 94, 0
- ],
- [
- 255, 72, 72
- ],
- [
- 255, 54, 54
- ],
- [
- 255, 18, 18
- ],
- [
- 237, 0, 0
- ],
- [
- 219, 0, 0
- ],
- [
- 201, 0, 0
- ],
- [
- 165, 0, 0
- ],
- [
- 147, 0, 0
- ],
- [
- 129, 0, 0
- ],
- [
- 111, 0, 0
- ],
- [
- 93, 0, 0
- ]
- ];
- a = [0] * len(color_table) for i in range(0, len(color_table)): a[i] = rgb2hex(color_table[i][0], color_table[i][1], color_table[i][2]) b = ['#000000', '#000000'] c = [
- "#00007F",
- "blue",
- "#007FFF",
- "cyan",
- "#7FFF7F",
- "yellow",
- "#FF7F00",
- "red"
- ] cmap_jet = LinearSegmentedColormap.from_list('mycmap', a) vcmap = LinearSegmentedColormap.from_list('vcmap', b) cmap_jet1 = LinearSegmentedColormap.from_list('mycmap', c) cmap_jet.set_under('w') cmap_jet.set_over('#2F0000') cmap_jet.set_bad('w') cmap_jet1.set_under('#00007F') cmap_jet1.set_over('#FF0000') cmap_jet1.set_bad('w')# In[13]: yy = np.arange(0, len(lat), 20) xx = np.arange(0, len(lon), 20) points = np.meshgrid(yy, xx) cv_tick = np.linspace(0.0, 2.0, 31, endpoint = True) cv_cbar_tick = np.linspace(0.0, 2.0, 11, endpoint = True) tp_cbar_tick = np.linspace(0.0, 33.0, 12, endpoint = True) tp_conf_tick = np.linspace(0.0, 33.0, 64, endpoint = True) tp_cont_tick = np.linspace(0.0, 33.0, 34, endpoint = True) sa_cbar_tick = np.linspace(25.0, 35.0, 6, endpoint = True) sa_conf_tick = np.linspace(25.0, 35.0, 64, endpoint = True) sa_cont_tick = np.linspace(25.0, 35.0, 21, endpoint = True)# < h1 > BS_cv < /h1> # In[16]: arrow_magn=20.0 dep = [0,10,25,50,75] depnum = [18,16,15,13,12] #surface /
- 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract varU = ncfile.variables[u 'u'][i, j,: ,: ] varV = ncfile.variables[u 'v'][i, j,: ,: ] varVM = ncfile.variables[u 'vm'][i, j,: ,: ] varVM =
- switch (
- varVM,
- j
- )# 마스크 계산 함수 호출...varVM = np.ma.array(varVM, mask = varVM <= 0.0) plt.contour(
- BS_X,
- BS_Y,
- varVM,
- cv_tick,
- linewidths = 0,
- color = 'k'
- ) bsmap.contourf(
- BS_X,
- BS_Y,
- varVM,
- cv_tick,
- cmap = cmap_jet,
- vmin = 0,
- vmax = 2,
- extend = 'both'
- )# color bar colorbar = bsmap.colorbar(
- location = 'right',
- size = 0.25,
- ticks = cv_cbar_tick,
- cmap = cmap_jet,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# vector mapping meana = np.mean(
- varVM[points]
- ) Q = bsmap.quiver(
- lon2D[points],
- lat2D[points],
- varU[points],
- varV[points],
- varVM[points],
- pivot = 'middle',
- cmap = vcmap,
- latlon = True,
- scale_units = 'inches',
- scale = meana * arrow_magn,
- minlength = 0.1,
- headwidth = 4.0
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- '' + str(int(1)) + 'm/s',
- labelpos = 'N',
- fontproperties = {
- 'weight': 'bold',
- 'size': '12'
- },
- labelsep = 0.1
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- 'Reference Vector',
- labelpos = 'S',
- fontproperties = {
- 'weight': 'bold',
- 'size': '12'
- },
- labelsep = 0.1
- ) BSPATCH = BSPOLY(bsmap) JPPATCH = JPPOLY(bsmap) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# gray background bsmap.drawparallels(np.arange(-150, 120, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.86,
- size = 15
- )# lat label# plt.annotate(
- u '32\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 32.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '34\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 34.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '36\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 36.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '38\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 38.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '40\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 40.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# lon label# plt.annotate(
- u '124\N{DEGREE SIGN}E',
- xy = (bsmap(124.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '126\N{DEGREE SIGN}E',
- xy = (bsmap(126.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '128\N{DEGREE SIGN}E',
- xy = (bsmap(128.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '130\N{DEGREE SIGN}E',
- xy = (bsmap(130.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '132\N{DEGREE SIGN}E',
- xy = (bsmap(132.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS_cv' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS_cv_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()# < h1 > BS_ST < /h1> # In[] : # In[15] : dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12] #surface /
- 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'temperature'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS_X,
- BS_Y,
- var,
- tp_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap.contourf(
- BS_X,
- BS_Y,
- var,
- tp_conf_tick,
- cmap = cmap_jet1,
- vmin = 0.0,
- vmax = 33.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2i',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY(bsmap) JPPATCH = JPPOLY(
- bsmap
- ) ax.add_collection(PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap.colorbar(
- location = 'right',
- size = 0.25,
- ticks = tp_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.863,
- size = 15
- )# lat label# plt.annotate(
- u '32\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 32.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '34\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 34.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '36\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 36.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '38\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 38.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '40\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 40.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# lon label# plt.annotate(
- u '124\N{DEGREE SIGN}E',
- xy = (bsmap(124.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '126\N{DEGREE SIGN}E',
- xy = (bsmap(126.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '128\N{DEGREE SIGN}E',
- xy = (bsmap(128.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '130\N{DEGREE SIGN}E',
- xy = (bsmap(130.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '132\N{DEGREE SIGN}E',
- xy = (bsmap(132.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS_temp' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS_temp_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()# < h1 > BS_SA < /h1> # In[16] : dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12] #surface /
- 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'salinity'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS_X,
- BS_Y,
- var,
- sa_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap.contourf(
- BS_X,
- BS_Y,
- var,
- sa_conf_tick,
- cmap = cmap_jet1,
- vmin = 25.0,
- vmax = 35.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2.1f',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY(bsmap) JPPATCH = JPPOLY(
- bsmap
- ) ax.add_collection(PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap.colorbar(
- location = 'right',
- size = 0.25,
- ticks = sa_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap.drawmapboundary(fill_color = 'white') plt.title(
- 'Salinity(psu)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.255,
- y = 0.863,
- size = 15
- )# lat label# plt.annotate(
- u '32\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 32.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '34\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 34.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '36\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 36.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '38\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 38.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '40\N{DEGREE SIGN}N',
- xy = (bsmap(123.0, 40.04)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# lon label# plt.annotate(
- u '124\N{DEGREE SIGN}E',
- xy = (bsmap(124.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '126\N{DEGREE SIGN}E',
- xy = (bsmap(126.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '128\N{DEGREE SIGN}E',
- xy = (bsmap(128.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '130\N{DEGREE SIGN}E',
- xy = (bsmap(130.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# plt.annotate(
- u '132\N{DEGREE SIGN}E',
- xy = (bsmap(132.3, 30.90)),
- color = 'lightgray',
- fontweight = 'bold',
- xycoords = 'data',
- horizontalalignment = 'center',
- verticalalignment = 'top',
- size = 9
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS_sa' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS_sa_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()# del fig# del ax# del bsmap# < h1 > BS1 CV < /h1> del varU del varV del varVM del var del Q yy = np.arange(
- 0,
- len(lat),
- 9
- ) xx = np.arange(0, len(lon), 9) points = np.meshgrid(yy, xx)# In[18]: arrow_magn = 10.0 dep = [0, 10, 25, 50, 75] depnum = [18, 16]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract varU = ncfile.variables[u 'u'][i, j,: ,: ] varV = ncfile.variables[u 'v'][i, j,: ,: ] varVM = ncfile.variables[u 'vm'][i, j,: ,: ] varVM =
- switch (
- varVM,
- j
- )# 마스크 계산 함수 호출...varVM = np.ma.array(varVM, mask = varVM <= 0.0) plt.contour(
- BS1_X,
- BS1_Y,
- varVM,
- cv_tick,
- linewidths = 0,
- color = 'k'
- ) bsmap1.contourf(
- BS1_X,
- BS1_Y,
- varVM,
- cv_tick,
- cmap = cmap_jet,
- vmin = 0,
- vmax = 2,
- extend = 'both'
- )# color bar colorbar = bsmap1.colorbar(
- location = 'right',
- size = 0.25,
- ticks = cv_cbar_tick,
- cmap = cmap_jet,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# vector mapping meana = np.mean(
- varVM[points]
- ) Q = bsmap1.quiver(
- lon2D[points],
- lat2D[points],
- varU[points],
- varV[points],
- varVM[points],
- pivot = 'middle',
- cmap = vcmap,
- latlon = True,
- scale_units = 'inches',
- scale = meana * arrow_magn,
- minlength = 0.1,
- headwidth = 4.0
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- '' + str(int(1)) + 'm/s',
- labelpos = 'N',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- 'Reference Vector',
- labelpos = 'S',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- )# ADD POLYGON BSPATCH = BSPOLY1(bsmap1) JPPATCH = JPPOLY(bsmap1)# plot bln line redline(
- bsmap1
- ) blueline(bsmap1) greenline(bsmap1) ax.add_collection(PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# gray background bsmap1.drawparallels(np.arange(-150, 120, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap1.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap1.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.900,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS1_cv' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS1_cv_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS1 TP# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'temperature'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS1_X,
- BS1_Y,
- var,
- tp_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap1.contourf(
- BS1_X,
- BS1_Y,
- var,
- tp_conf_tick,
- cmap = cmap_jet1,
- vmin = 0.0,
- vmax = 33.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2i',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY1(bsmap1) JPPATCH = JPPOLY(
- bsmap1
- ) redline(bsmap1) blueline(bsmap1) greenline(bsmap1) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap1.colorbar(
- location = 'right',
- size = 0.25,
- ticks = tp_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap1.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap1.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap1.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.900,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS1_temp' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- )# plt.savefig('AAAAA.png') print(
- 'BS1_temp_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()# < h1 > BS1 SA < /h1> # In[] : dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12] #surface /
- 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'salinity'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS1_X,
- BS1_Y,
- var,
- sa_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap1.contourf(
- BS1_X,
- BS1_Y,
- var,
- sa_conf_tick,
- cmap = cmap_jet1,
- vmin = 25.0,
- vmax = 35.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2.1f',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY1(bsmap1) JPPATCH = JPPOLY(
- bsmap1
- ) redline(bsmap1) blueline(bsmap1) greenline(bsmap1) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap1.colorbar(
- location = 'right',
- size = 0.25,
- ticks = sa_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap1.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap1.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap1.drawmapboundary(fill_color = 'white') plt.title(
- 'Salinity(psu)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.255,
- y = 0.900,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS1_sa' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS1_sa_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS2 CV del varU del varV del varVM del
- var del Q arrow_magn = 10.0 dep = [0, 10, 25, 50, 75] depnum = [18, 16]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract varU = ncfile.variables[u 'u'][i, j,: ,: ] varV = ncfile.variables[u 'v'][i, j,: ,: ] varVM = ncfile.variables[u 'vm'][i, j,: ,: ] varVM =
- switch (
- varVM,
- j
- )# 마스크 계산 함수 호출...varVM = np.ma.array(varVM, mask = varVM <= 0.0) plt.contour(
- BS2_X,
- BS2_Y,
- varVM,
- cv_tick,
- linewidths = 0,
- color = 'k'
- ) bsmap2.contourf(
- BS2_X,
- BS2_Y,
- varVM,
- cv_tick,
- cmap = cmap_jet,
- vmin = 0,
- vmax = 2,
- extend = 'both'
- )# color bar colorbar = bsmap2.colorbar(
- location = 'right',
- size = 0.25,
- ticks = cv_cbar_tick,
- cmap = cmap_jet,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# vector mapping meana = np.mean(
- varVM[points]
- ) Q = bsmap2.quiver(
- lon2D[points],
- lat2D[points],
- varU[points],
- varV[points],
- varVM[points],
- pivot = 'middle',
- cmap = vcmap,
- latlon = True,
- scale_units = 'inches',
- scale = meana * arrow_magn,
- minlength = 0.1,
- headwidth = 4.0
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- '' + str(int(1)) + 'm/s',
- labelpos = 'N',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- 'Reference Vector',
- labelpos = 'S',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- )# ADD POLYGON BSPATCH = BSPOLY2(bsmap2) JPPATCH = JPPOLY(bsmap2)# plot bln line redline(
- bsmap2
- ) blueline(bsmap2) greenline(bsmap2) ax.add_collection(PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# gray background bsmap2.drawparallels(np.arange(-150, 120, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap2.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap2.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.880,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS2_cv' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS2_cv_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS2 - TP# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'temperature'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS2_X,
- BS2_Y,
- var,
- tp_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap2.contourf(
- BS2_X,
- BS2_Y,
- var,
- tp_conf_tick,
- cmap = cmap_jet1,
- vmin = 0.0,
- vmax = 33.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2i',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY2(bsmap2) JPPATCH = JPPOLY(
- bsmap2
- ) redline(bsmap2) blueline(bsmap2) greenline(bsmap2) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap2.colorbar(
- location = 'right',
- size = 0.25,
- ticks = tp_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap2.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap2.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap2.drawmapboundary(fill_color = 'white') plt.title(
- 'Salinity(psu)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.255,
- y = 0.880,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS2_temp' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- )# plt.savefig('AAAAA.png') print(
- 'BS2_temp_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS2 - SA# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'salinity'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS2_X,
- BS2_Y,
- var,
- sa_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap2.contourf(
- BS2_X,
- BS2_Y,
- var,
- sa_conf_tick,
- cmap = cmap_jet1,
- vmin = 25.0,
- vmax = 35.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2.1f',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY2(bsmap2) JPPATCH = JPPOLY(
- bsmap2
- ) redline(bsmap2) blueline(bsmap2) greenline(bsmap2) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap2.colorbar(
- location = 'right',
- size = 0.25,
- ticks = sa_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap2.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap2.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap2.drawmapboundary(fill_color = 'white') plt.title(
- u 'Seawater Temperature(\N{DEGREE SIGN}C)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.435,
- y = 0.880,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS2_temp' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS2_temp_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS3 - CV del varU del varV del varVM del
- var del Q arrow_magn = 10.0 dep = [0, 10, 25, 50, 75] depnum = [18, 16]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract varU = ncfile.variables[u 'u'][i, j,: ,: ] varV = ncfile.variables[u 'v'][i, j,: ,: ] varVM = ncfile.variables[u 'vm'][i, j,: ,: ] varVM =
- switch (
- varVM,
- j
- )# 마스크 계산 함수 호출...varVM = np.ma.array(varVM, mask = varVM <= 0.0) plt.contour(
- BS3_X,
- BS3_Y,
- varVM,
- cv_tick,
- linewidths = 0,
- color = 'k'
- ) bsmap3.contourf(
- BS3_X,
- BS3_Y,
- varVM,
- cv_tick,
- cmap = cmap_jet,
- vmin = 0,
- vmax = 2,
- extend = 'both'
- )# color bar colorbar = bsmap3.colorbar(
- location = 'right',
- size = 0.25,
- ticks = cv_cbar_tick,
- cmap = cmap_jet,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# vector mapping meana = np.mean(
- varVM[points]
- ) Q = bsmap3.quiver(
- lon2D[points],
- lat2D[points],
- varU[points],
- varV[points],
- varVM[points],
- pivot = 'middle',
- cmap = vcmap,
- latlon = True,
- scale_units = 'inches',
- scale = meana * arrow_magn,
- minlength = 0.1,
- headwidth = 4.0
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- '' + str(int(1)) + 'm/s',
- labelpos = 'N',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- 'Reference Vector',
- labelpos = 'S',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- )# ADD POLYGON BSPATCH = BSPOLY3(bsmap3) JPPATCH = JPPOLY(bsmap3)# plot bln line redline(
- bsmap3
- ) blueline(bsmap3) greenline(bsmap3) ax.add_collection(PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# gray background bsmap3.drawparallels(np.arange(-150, 120, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap3.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap3.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.900,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS3_cv' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS3_cv_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS3 - TP# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'temperature'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS3_X,
- BS3_Y,
- var,
- tp_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap3.contourf(
- BS3_X,
- BS3_Y,
- var,
- tp_conf_tick,
- cmap = cmap_jet1,
- vmin = 0.0,
- vmax = 33.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2i',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY3(bsmap3) JPPATCH = JPPOLY(
- bsmap3
- ) redline(bsmap3) blueline(bsmap3) greenline(bsmap3) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap3.colorbar(
- location = 'right',
- size = 0.25,
- ticks = tp_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap3.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap3.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap3.drawmapboundary(fill_color = 'white') plt.title(
- u 'Seawater Temperature(\N{DEGREE SIGN}C)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.435,
- y = 0.900,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS3_temp' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- )# plt.savefig('AAAAA.png') print(
- 'BS3_temp_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS3 - SA# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'salinity'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS3_X,
- BS3_Y,
- var,
- sa_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap3.contourf(
- BS3_X,
- BS3_Y,
- var,
- sa_conf_tick,
- cmap = cmap_jet1,
- vmin = 25.0,
- vmax = 35.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2.1f',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY3(bsmap3) JPPATCH = JPPOLY(
- bsmap3
- ) redline(bsmap3) blueline(bsmap3) greenline(bsmap3) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap3.colorbar(
- location = 'right',
- size = 0.25,
- ticks = sa_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap3.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap3.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap3.drawmapboundary(fill_color = 'white') plt.title(
- 'Salinity(psu)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.255,
- y = 0.880,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS3_sa' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS3_sa_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS4 - CV del varU del varV del varVM del
- var del Q arrow_magn = 10.0 dep = [0, 10, 25, 50, 75] depnum = [18, 16]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in depnum: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract varU = ncfile.variables[u 'u'][i, j,: ,: ] varV = ncfile.variables[u 'v'][i, j,: ,: ] varVM = ncfile.variables[u 'vm'][i, j,: ,: ] varVM =
- switch (
- varVM,
- j
- )# 마스크 계산 함수 호출...varVM = np.ma.array(varVM, mask = varVM <= 0.0) plt.contour(
- BS4_X,
- BS4_Y,
- varVM,
- cv_tick,
- linewidths = 0,
- color = 'k'
- ) bsmap4.contourf(
- BS4_X,
- BS4_Y,
- varVM,
- cv_tick,
- cmap = cmap_jet,
- vmin = 0,
- vmax = 2,
- extend = 'both'
- )# color bar colorbar = bsmap4.colorbar(
- location = 'right',
- size = 0.25,
- ticks = cv_cbar_tick,
- cmap = cmap_jet,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# vector mapping meana = np.mean(
- varVM[points]
- ) Q = bsmap4.quiver(
- lon2D[points],
- lat2D[points],
- varU[points],
- varV[points],
- varVM[points],
- pivot = 'middle',
- cmap = vcmap,
- latlon = True,
- scale_units = 'inches',
- scale = meana * arrow_magn,
- minlength = 0.1,
- headwidth = 4.0
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- '' + str(int(1)) + 'm/s',
- labelpos = 'N',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- ) plt.quiverkey(
- Q,
- 0.1,
- 0.95,
- 1,
- 'Reference Vector',
- labelpos = 'S',
- fontproperties = {
- 'weight': 'bold',
- 'size': '14'
- },
- labelsep = 0.1
- )# ADD POLYGON BSPATCH = BSPOLY4(bsmap4) JPPATCH = JPPOLY(bsmap4)# plot bln line redline(
- bsmap4
- ) blueline(bsmap4) greenline(bsmap4) ax.add_collection(PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# gray background bsmap4.drawparallels(np.arange(-150, 120, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap4.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap4.drawmapboundary(fill_color = 'white') plt.title(
- 'Currend Vectors(m/s)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.365,
- y = 0.840,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.035),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.065),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS4_cv' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS4_cv_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS4 - TE# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'temperature'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS4_X,
- BS4_Y,
- var,
- tp_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap4.contourf(
- BS4_X,
- BS4_Y,
- var,
- tp_conf_tick,
- cmap = cmap_jet1,
- vmin = 0.0,
- vmax = 33.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2i',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY4(bsmap4) JPPATCH = JPPOLY(
- bsmap4
- ) redline(bsmap4) blueline(bsmap4) greenline(bsmap4) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap4.colorbar(
- location = 'right',
- size = 0.25,
- ticks = tp_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap4.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap4.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap4.drawmapboundary(fill_color = 'white') plt.title(
- u 'Seawater Temperature(\N{DEGREE SIGN}C)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.435,
- y = 0.840,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS4_temp' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- )# plt.savefig('AAAAA.png') print(
- 'BS4_temp_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show()## BS4 - SA# In[]: dep = [0, 10, 25, 50, 75] depnum = [18, 16, 15, 13, 12]# surface / 10 m / 25 m / 50 m / 75 m
- for i in range(0, timelen, 1): depcount = -1
- for j in [18, 16]: #print(j) depcount += 1# fig Size fig = plt.figure(figsize = (10, 12.5)) ax = fig.add_subplot(111)# style plt.style.use('seaborn-darkgrid')# define font size plt.rc("font", size = 15) plt.rcParams['font.family'] = 'sans-serif'
- plt.rcParams['font.sans-serif'] = 'New Century Schoolbook'
- plt.rcParams["font.weight"] = "bold"
- plt.rcParams['axes.labelsize'] = 26 plt.rcParams['xtick.labelsize'] = 26 plt.rcParams['ytick.labelsize'] = 26 plt.rcParams["axes.labelweight"] = "bold"
- plt.rcParams["axes.titleweight"] = "bold"
- plt.rcParams['contour.corner_mask'] = False plt.rcParams.update({
- 'figure.autolayout': True
- })# vector extract
- var = ncfile.variables[u 'salinity'][i, j,: ,: ]
- var =
- switch (var, j)# 마스크 계산 함수 호출...
- var = np.ma.array(var, mask =
- var <= 0.0) cc = plt.contour(
- BS4_X,
- BS4_Y,
- var,
- sa_cont_tick,
- linewidths = 1,
- cmap = vcmap
- ) bsmap4.contourf(
- BS4_X,
- BS4_Y,
- var,
- sa_conf_tick,
- cmap = cmap_jet1,
- vmin = 25.0,
- vmax = 35.0,
- extend = 'both'
- ) plt.clabel(
- cc,
- inline = True,
- fontsize = 12,
- fmt = '%2.1f',
- colors = 'k',
- inline_spacing = 3.0
- )# FILL POLYGON COLOR AND PLOT BOUNDATY LINE BSPATCH = BSPOLY4(bsmap4) JPPATCH = JPPOLY(
- bsmap4
- ) redline(bsmap4) blueline(bsmap4) greenline(bsmap4) ax.add_collection(
- PatchCollection(
- BSPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- )
- ) ax.add_collection(PatchCollection(
- JPPATCH,
- facecolor = 'lightgray',
- edgecolor = 'k',
- linewidths = 0.5,
- zorder = 1
- ))# color bar colorbar = bsmap4.colorbar(
- location = 'right',
- size = 0.25,
- ticks = sa_cbar_tick,
- cmap = cmap_jet1,
- extendrect = 'False'
- ) colorbar.ax.set_yticklabels(colorbar.ax.get_yticklabels(), fontsize = 11)# white background gray fill contin bsmap4.drawparallels(
- np.arange(-150, 120, 2),
- labels = [
- 0, 0, 0, 0
- ],
- dashes = [
- 2, 2
- ],
- color = 'lightgray'
- ) bsmap4.drawmeridians(np.arange(-180, 180, 2), labels = [
- 0, 0, 0, 0
- ], dashes = [
- 2, 2
- ], color = 'lightgray') bsmap4.drawmapboundary(fill_color = 'white') plt.title(
- 'Salinity(psu)',
- loc = 'left',
- size = 20
- ) plt.suptitle(
- '[depth : ' + str(int(dep[depcount])) + 'm]',
- x = 0.255,
- y = 0.840,
- size = 15
- )# time label plt.annotate(
- 'VALID :' + times[i] + ' UTC',
- xy = (0.0, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[i] + ' KST',
- xy = (0.092, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- 'TIME :' + times[0] + ' UTC',
- xy = (0.7, -0.03),
- color = 'red',
- fontweight = 'bold',
- textcoords = 'axes fraction',f
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.annotate(
- local_dt[0] + ' KST',
- xy = (0.780, -0.055),
- color = 'black',
- fontweight = 'bold',
- textcoords = 'axes fraction',
- verticalalignment = 'left',
- xycoords = 'data',
- size = 15
- ) plt.savefig(
- 'BS4_sa' + times[i] + 'h _' + str(int(dep[depcount])) + 'm_layer.png'
- ) print(
- 'BS_sa_' + times[i] + 'h_' + str(int(dep[depcount])) +
- 'm_layer.png SUCCESS!!'
- )# plt.show() stop = timeit.default_timer() print(stop - start)# In[]:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement