Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit 1b472f51 authored by claplace's avatar claplace
Browse files

add some new colorbad binary jet which is a mixing between binary and jet and new colorbar

parent 58e94924
......@@ -2,7 +2,8 @@
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pylab as plot
from matplotlib.colors import rgb2hex
from matplotlib.colors import rgb2hex, LinearSegmentedColormap
from matplotlib import cm
import sys
import os
import csv
......@@ -16,6 +17,41 @@ from xml_conf import *
# # colour's name
# name_colour = str(sys.argv[2])
def create_cmap(name_map,cmap_low, cmap_high,num_cmap_low):
"""
Create diverging colormap based on 2 matplotlib colormap.
Parameters
----------
name_map : str
Name of the new colormap that will be stored
cmap_low : str
Name of a matplotlib cmap.
cmap_high : str
Name of a matplotlib cmap.
num_cmap_low: int
Define where the cmap_low colorbar stops, it must be betwen 0 and 256. At 128 it means that half of the colorbar is occupied by
Returns
-------
matplotlib.colors.LinearSegmentedColormap
New generated colormap.
"""
colors_low = cm.get_cmap(cmap_low)(np.linspace(0., 1, num_cmap_low))
colors_high = cm.get_cmap(cmap_high)(np.linspace(0., 1, 256-num_cmap_low))
colors = np.vstack((colors_low, colors_high))
new_cmap = LinearSegmentedColormap.from_list('my_colormap', colors)
cm.register_cmap(name=name_map,cmap=new_cmap)
return new_cmap
# creation of the colormap
# colorbar where the lower of the half part is black and white and the other half defined by jet colormap
binaryjet = create_cmap('binaryjet','binary', 'jet',128)
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#from color_hexa import create_cmap
n_sep=15
PV_col = { 10: [-450,401,n_sep],
......@@ -130,33 +132,54 @@ GPH_col = { 10: [30440,31445,n_sep],
# TP= Total Precipitation en mm/h
TP_col= {'sfc':[0.0001,0.5,n_sep]}
# HCCT
# HCCT (m)
HCCT_col= {'sfc':[0,18000,n_sep]}
IR108_col= {'sfc':[195,315,n_sep]}
# channel 10.8 µm (K)
IR108_col= {'sfc':[180,320,n_sep]}
# channel 10.8 µm (K)
IR103_col= {'sfc':[180,320,n_sep]}
# 6.3 µm channel (K)
WV063_col= {'sfc':[195,260,n_sep]}
# 7.4 µm channel
WV074_col={'sfc':[190,280,n_sep]}
# windshear (s **-1)
windshear_col={'sfc':[-0.015,0.015,n_sep]}
# 10.4 µm channel (K)
IR104_col={'sfc':[180,320,n_sep]}
# 6.2 µm channel (K)
WV062_col= {'sfc':[180,260,n_sep]}
dest_dir="/home/rchea/Documents/layer_style/test_xml"
# 6.2 µm channel (K)
IR062_col= {'sfc':[180,260,n_sep]}
# directory to write the xml files
#dest_dir="/home/rchea/Documents/layer_style/test_xml"
dest_dir = "/homedata/s2dac/test_xml"
dict_colorbar = {
#"PV":{"level":PV_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"PVU"},
#"U":{"level":U_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m s**-1"},
#"V":{"level":V_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m s**-1"},
#"T":{"level":T_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"K"},
#"RH":{"level":RH_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"%"},
#"W":{"level":W_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"CAT":{"level":CAT_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"CIT":{"level":PV_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"TP":{"level":TP_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"mm h**-1"},
#"HCCT":{"level":HCCT_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"IR108":{"level":IR108_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"WV063":{"level":WV063_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"WV074":{"level":WV074_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
#"windshear":{"level":windshear_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"s**-1"}}
"PV":{"level":PV_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"PVU"},
"U":{"level":U_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m s**-1"},
"V":{"level":V_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m s**-1"},
"T":{"level":T_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"K"},
"RH":{"level":RH_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"%"},
"W":{"level":W_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
"CAT":{"level":CAT_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
"CIT":{"level":PV_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
"TP":{"level":TP_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"mm h**-1"},
"HCCT":{"level":HCCT_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"},
"IR108":{"level":IR108_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"WV063":{"level":WV063_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"WV074":{"level":WV074_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"windshear":{"level":windshear_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"s**-1"},
"IR104":{"level":IR104_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"IR062":{"level":IR062_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"WV062":{"level":WV062_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"IR103":{"level":IR103_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"WV063":{"level":WV063_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"binaryjet","label":"K"},
"GPH":{"level":GPH_col,"title":"ECMWF-METEO","dest_dir":dest_dir,"palette":"jet","label":"m"}}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment