Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
claplace
XML colorbar
Commits
18937df7
Commit
18937df7
authored
Oct 18, 2021
by
claplace
Browse files
Change dependance and add the label
parent
4e0aa3bc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
color_hexa.py
color_hexa.py
+7
-6
xml_conf.py
xml_conf.py
+14
-14
No files found.
color_hexa.py
View file @
18937df7
...
...
@@ -49,7 +49,7 @@ def list_amplitude(ampl):
"""
return
list
(
np
.
linspace
(
ampl
[
0
],
ampl
[
1
],
num
=
ampl
[
2
]))
def
write_xmlfile
(
file_dest
,
list_colour
,
list_amplitude
,
name_file
,
dict_att
):
def
write_xmlfile
(
file_dest
,
list_colour
,
list_amplitude
,
name_file
,
dict_att
,
label
):
"""[summary]
Args:
...
...
@@ -67,12 +67,13 @@ def write_xmlfile(file_dest,list_colour,list_amplitude,name_file,dict_att):
Userstyle
=
SubElement
(
NameLayer
,
'Userstyle'
)
Title
=
SubElement
(
Userstyle
,
'Title'
)
Title
.
text
=
name_file
FeatureTypeStyle
=
SubElement
(
NameLayer
,
'FeatureTypeStyle'
)
FeatureTypeStyle
=
SubElement
(
Userstyle
,
'FeatureTypeStyle'
)
Rule
=
SubElement
(
FeatureTypeStyle
,
'Rule'
)
RasterSymbolizer
=
SubElement
(
Rule
,
'RasterSymbolizer'
)
colormap
=
SubElement
(
RasterSymbolizer
,
'ColorMap'
)
for
col
,
amp
in
zip
(
list_colour
,
list_amplitude
):
dict_colamp
=
{
'color'
:
col
,
'quantity'
:
str
(
amp
)}
ColorMapEntry
=
SubElement
(
RasterSymbolizer
,
'ColorMapEntry'
,
attrib
=
dict_colamp
)
dict_colamp
=
{
'color'
:
col
,
'quantity'
:
str
(
amp
)
,
'label'
:
label
}
ColorMapEntry
=
SubElement
(
colormap
,
'ColorMapEntry'
,
attrib
=
dict_colamp
)
tree
=
ET
.
ElementTree
(
root
)
tree
.
write
(
file_dest
,
encoding
=
"ISO-8859-1"
)
#return root
...
...
@@ -90,7 +91,7 @@ for var in dict_colorbar:
colorbar
=
subdict
[
"palette"
]
dest_dir
=
subdict
[
"dest_dir"
]
title
=
subdict
[
"title"
]
label
=
subdict
[
"label"
]
if
not
os
.
path
.
isdir
(
dest_dir
):
print
(
"creation of the directory : "
+
dest_dir
)
os
.
makedirs
(
dest_dir
)
...
...
@@ -103,4 +104,4 @@ for var in dict_colorbar:
print
(
"Total title : "
+
Total_tile
)
dest_file
=
dest_dir
+
"/"
+
Total_tile
+
".xml"
print
(
"dest_file :"
+
dest_file
)
write_xmlfile
(
dest_file
,
list_colorbar
,
segm_ampl
,
Total_tile
,
dict_elem
)
\ No newline at end of file
write_xmlfile
(
dest_file
,
list_colorbar
,
segm_ampl
,
Total_tile
,
dict_elem
,
label
)
\ No newline at end of file
xml_conf.py
View file @
18937df7
...
...
@@ -159,17 +159,17 @@ windshear_col={'sfc':[-10,10,n_sep]}
dict_colorbar
=
{
"PV"
:{
"level"
:
PV_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"U"
:{
"level"
:
U_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"V"
:{
"level"
:
V_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"T"
:{
"level"
:
T_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"RH"
:{
"level"
:
RH_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"W"
:{
"level"
:
W_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"CAT"
:{
"level"
:
CAT_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"CIT"
:{
"level"
:
PV_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"TP"
:{
"level"
:
TP_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"HCCT"
:{
"level"
:
HCCT_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"IR108"
:{
"level"
:
IR108_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"WV063"
:{
"level"
:
WV063_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"WV074"
:{
"level"
:
WV074_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
},
"windshear"
:{
"level"
:
windshear_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
}}
\ No newline at end of file
dict_colorbar
=
{
"PV"
:{
"level"
:
PV_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"PVU"
},
"U"
:{
"level"
:
U_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m s**-1"
},
"V"
:{
"level"
:
V_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m s**-1"
},
"T"
:{
"level"
:
T_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"K"
},
"RH"
:{
"level"
:
RH_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"%"
},
"W"
:{
"level"
:
W_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"CAT"
:{
"level"
:
CAT_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"CIT"
:{
"level"
:
PV_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"TP"
:{
"level"
:
TP_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"mm h**-1"
},
"HCCT"
:{
"level"
:
HCCT_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"IR108"
:{
"level"
:
IR108_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"WV063"
:{
"level"
:
WV063_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"WV074"
:{
"level"
:
WV074_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
},
"windshear"
:{
"level"
:
windshear_col
,
"title"
:
"ECMWF-METEO"
,
"dest_dir"
:
"/homedata/s2dac/test_xml"
,
"palette"
:
"jet"
,
"label"
:
"m"
}}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment