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

Commit a3b2ac61 authored by claplace's avatar claplace
Browse files

Project initialisation

parents
# Colorbar custom xml files
This script is dedicated to create a custom colorbar based on the colormap used in [matplotolib](https://matplotlib.org/stable/tutorials/colors/colormaps.html). The output is written in a xml file for each variable and each level. In this project there is two .py files that we will describe below
## xml_conf.py
This is the configuration files that contains the variable's names,the number of segmentation, the minimum, the maximum. All this information are stocked into a python dictionary object.
For example
```python
U_col = {
10:[-40,50,n_sep],
20:[-40,40,n_sep],
30:[-25,32,n_sep],
50:[-20,30,n_sep],
70:[-20,30,n_sep],
100:[-30,50,n_sep],
150:[-30,60,n_sep],
200:[-30,75,n_sep],
500:[-30,50,n_sep],
1000:[-24,24,n_sep]
}
```
This is the minimum,maximum and number of segmentation for each level of the eastward wind (U).
## color_hexa.py
This is the script used to write the xml files. To run this script you need to do
```bash
python color_hexa.py
```
\ No newline at end of file
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pylab as plot
from matplotlib.colors import rgb2hex
import sys
import os
import csv
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
import xml.etree.cElementTree as ET
import datetime
from xml.dom import minidom
from xml_conf import *
# Number of limitation
# number_segm = int(sys.argv[1])
# # colour's name
# name_colour = str(sys.argv[2])
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_string)
return reparsed.toprettyxml(indent=" ")
def colour_list(number_segm,name_colour):
"""[]
Args:
number_segm ([int]): [Number of segmentation]
name_colour ([str]): [Type of colour ]
"""
cmap = plot.cm.get_cmap(name_colour, number_segm)
list_cmap=[]
for i in range(cmap.N):
rgba = cmap(i)
list_cmap.append(rgb2hex(rgba))
return list_cmap
def list_amplitude(ampl):
"""[summary]
Args:
ampl ([list]): [number of ]
number_segm ([int]): [number of segment]
Returns:
[list]: [list with all the ]
"""
return list(np.linspace(ampl[0],ampl[1],num=ampl[2]))
def write_xmlfile(file_dest,list_colour,list_amplitude,name_file,dict_att):
"""[summary]
Args:
file_dest ([type]): [description]
list_colour ([type]): [description]
list_amplitude ([type]): [description]
level ([type]): [description]
name_ac ([type]): [description]
"""
root = Element('StyledLayerDescriptor',attrib=dict_att)
root.set('version','1')
NameLayer = SubElement(root, 'NamedLayer')
Name = SubElement(NameLayer,'Name')
Name.text = name_file
Userstyle = SubElement(NameLayer,'Userstyle')
Title = SubElement(Userstyle,'Title')
Title.text = name_file
FeatureTypeStyle = SubElement(NameLayer,'FeatureTypeStyle')
Rule = SubElement(FeatureTypeStyle,'Rule')
RasterSymbolizer = SubElement(Rule,'RasterSymbolizer')
for col,amp in zip(list_colour,list_amplitude):
dict_colamp = {'colour':col,'amp':amp}
ColorMapEntry = SubElement(RasterSymbolizer,'ColorMapEntry',attib=dict_colamp)
tree = ET.ElementTree(root)
tree.write(file_dest,encoding="ISO-8859-1")
#return root
dict_elem = { 'xsi:schemaLocation':"http://www.opengis.net/sld StyledLayerDescriptor.xsd",
'xmlns':"http://www.opengis.net/sld",
'xmlns:ogc':"http://www.opengis.net/ogc",
'xmlns:xlink':"http://www.w3.org/1999/xlink",
'xmlns:xsi':"http://www.w3.org/2001/XMLSchema-instance" }
# Loop through the dictionary
for var in dict_colorbar:
subdict= dict_colorbar[var]
colorbar=subdict["palette"]
dest_dir=subdict["dest_dir"]
title = subdict["title"]
if not os.path.isdir(dest_dir):
print("creation of the directory : "+dest_dir)
os.makedirs(dest_dir)
subsubdict= subdict["level"]
for level in subsubdict:
list_level = subsubdict[level]
list_colorbar = colour_list(list_level[2],colorbar)
segm_ampl = list_amplitude(list_level)
Total_tile= title+"-"+var+"_LEVEL_"+str(level)
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
name: env3.6
channels:
- conda-forge
- defaults
dependencies:
- asn1crypto=0.24.0=py37_1003
- attrs=18.2.0=py_0
- backcall=0.1.0=py_0
- blas=1.0=mkl
- bleach=3.1.0=py_0
- bokeh=1.0.4=py37_1000
- boost-cpp=1.68.0=h11c811c_1000
- bzip2=1.0.6=h14c3975_1002
- ca-certificates=2021.7.5=h06a4308_1
- cairo=1.14.12=h80bd089_1005
- cartopy=0.17.0=py37h0aa2c8f_1004
- certifi=2021.5.30=py37h06a4308_0
- cffi=1.11.5=py37h9745a5d_1001
- cftime=1.0.3.4=py37h3010b51_1000
- chardet=3.0.4=py37_1003
- click=7.0=py_0
- click-plugins=1.0.4=py_0
- cligj=0.5.0=py_0
- cloudpickle=0.7.0=py_0
- colorcet=1.0.0=py_0
- cryptography=2.5=py37hb7f436b_0
- curl=7.63.0=h646f8bb_1000
- cycler=0.10.0=py_1
- cytoolz=0.9.0.1=py37h14c3975_1001
- dask=1.1.1=py_0
- dask-core=1.1.1=py_0
- datashader=0.6.9=py_0
- datashape=0.5.4=py37_1
- dbus=1.13.2=h714fa37_1
- decorator=4.3.2=py_0
- descartes=1.1.0=py_2
- distributed=1.25.3=py37_0
- entrypoints=0.3=py37_1000
- expat=2.2.5=hf484d3e_1002
- fiona=1.8.4=py37h1c6dbfb_1002
- fontconfig=2.13.1=h2176d3f_1000
- freetype=2.9.1=h94bbf69_1005
- freexl=1.0.5=h14c3975_1002
- gdal=2.4.0=py37h1c6dbfb_1002
- geopandas=0.4.0=py_1
- geos=3.7.1=hf484d3e_1000
- geotiff=1.4.3=h1105359_1000
- geoviews=1.6.2=py_0
- geoviews-core=1.6.2=py_0
- gettext=0.19.8.1=h9745a5d_1001
- giflib=5.1.4=h14c3975_1001
- glib=2.56.2=had28632_1001
- gst-plugins-base=1.14.0=hbbd80ab_1
- gstreamer=1.14.0=hb453b48_1
- hdf4=4.2.13=h9a582f1_1002
- hdf5=1.10.4=nompi_h11e915b_1105
- heapdict=1.0.0=py37_1000
- holoviews=1.11.2=py_0
- icu=58.2=hf484d3e_1000
- idna=2.8=py37_1000
- imageio=2.5.0=py37_0
- intel-openmp=2019.1=144
- ipykernel=5.1.0=py37h24bf2e0_1002
- ipython=7.1.1=py37h24bf2e0_1000
- ipython_genutils=0.2.0=py_1
- ipywidgets=7.4.2=py_0
- jedi=0.13.2=py37_1000
- jinja2=2.10=py_1
- jpeg=9c=h14c3975_1001
- json-c=0.13.1=h14c3975_1001
- jsonschema=3.0.0a3=py37_1000
- jupyter=1.0.0=py_1
- jupyter_client=5.2.4=py_1
- jupyter_console=6.0.0=py_0
- jupyter_core=4.4.0=py_0
- kealib=1.4.10=he7154bc_1002
- kiwisolver=1.0.1=py37h6bb024c_1002
- krb5=1.16.2=hc83ff2d_1000
- libcurl=7.63.0=h01ee5af_1000
- libdap4=3.19.1=hd48c02d_1000
- libedit=3.1.20181209=hc058e9b_0
- libffi=3.2.1=hd88cf55_4
- libgcc-ng=8.2.0=hdf63c60_1
- libgdal=2.4.0=h982c1cc_1002
- libgfortran-ng=7.2.0=hdf63c60_3
- libiconv=1.15=h14c3975_1004
- libkml=1.3.0=h328b03d_1009
- libnetcdf=4.6.2=hbdf4f91_1001
- libpng=1.6.36=h84994c4_1000
- libpq=10.6=h13b8bad_1000
- libsodium=1.0.16=h14c3975_1001
- libspatialindex=1.8.5=hf484d3e_1003
- libspatialite=4.3.0a=hb5ec416_1026
- libssh2=1.8.0=h1ad7b7a_1003
- libstdcxx-ng=8.2.0=hdf63c60_1
- libtiff=4.0.10=h648cc4a_1001
- libuuid=2.32.1=h14c3975_1000
- libxcb=1.13=h14c3975_1002
- libxml2=2.9.8=h143f9aa_1005
- libxslt=1.1.32=h4785a14_1002
- llvmlite=0.26.0=py37hdbcaa40_1000
- locket=0.2.0=py_2
- lxml=4.3.1=py37h23eabaa_0
- markupsafe=1.1.0=py37h14c3975_1000
- matplotlib=3.0.2=py37h8a2030e_1001
- matplotlib-base=3.0.2=py37h167e16e_1001
- mistune=0.8.4=py37h14c3975_1000
- mkl=2019.1=144
- mkl_fft=1.0.10=py37h14c3975_1
- mkl_random=1.0.2=py37h637b7d7_2
- msgpack-python=0.6.1=py37h6bb024c_0
- multipledispatch=0.6.0=py_0
- munch=2.3.2=py_0
- nbconvert=5.3.1=py_1
- nbformat=4.4.0=py_1
- ncurses=6.1=he6710b0_1
- netcdf4=1.4.2=py37had69b76_1001
- networkx=2.2=py_1
- notebook=5.7.4=py37_1000
- numba=0.41.0=py37h637b7d7_1000
- numpy=1.15.4=py37h7e9f1db_0
- numpy-base=1.15.4=py37hde5b4d6_0
- olefile=0.46=py_0
- openjpeg=2.3.0=hf38bd82_1003
- openssl=1.0.2u=h7b6447c_0
- owslib=0.17.1=py_0
- packaging=19.0=py_0
- palettable=3.1.1=py_0
- pandas=0.24.1=py37hf484d3e_0
- pandoc=2.6=1
- pandocfilters=1.4.2=py_1
- param=1.8.2=py_0
- parso=0.3.3=py_0
- partd=0.3.9=py_0
- patsy=0.5.1=py_0
- pcre=8.42=h439df22_0
- pexpect=4.6.0=py37_1000
- pickleshare=0.7.5=py37_1000
- pillow=5.3.0=py37h00a061d_1000
- pip=19.0.1=py37_0
- pixman=0.34.0=h14c3975_1003
- poppler=0.67.0=h2fc8fa2_1002
- poppler-data=0.4.9=1
- postgresql=10.6=h66cca7a_1000
- proj4=5.2.0=h14c3975_1001
- prometheus_client=0.5.0=py_0
- prompt_toolkit=2.0.8=py_0
- psutil=5.5.0=py37h14c3975_0
- psycopg2=2.7.7=py37hb7f436b_0
- pthread-stubs=0.4=h14c3975_1001
- ptyprocess=0.6.0=py37_1000
- pycparser=2.19=py_0
- pyct=0.4.6=py_0
- pyct-core=0.4.6=py_0
- pyepsg=0.4.0=py_0
- pygments=2.3.1=py_0
- pykdtree=1.3.1=py37h3010b51_1002
- pyopenssl=19.0.0=py37_0
- pyparsing=2.3.1=py_0
- pyproj=1.9.6=py37hc0953d3_1000
- pyqt=5.6.0=py37h13b7fb3_1008
- pyrsistent=0.14.10=py37h14c3975_0
- pysal=2.0.0=py_0
- pyshp=2.0.1=py_0
- pysocks=1.6.8=py37_1002
- python=3.7.1=hd21baee_1000
- python-dateutil=2.8.0=py_0
- pytz=2018.9=py_0
- pyviz_comms=0.7.0=py_0
- pywavelets=1.0.1=py37h3010b51_1000
- pyyaml=3.13=py37h14c3975_1001
- pyzmq=17.1.2=py37h6afc9c9_1001
- qt=5.6.3=h8bf5577_3
- qtconsole=4.4.3=py_0
- readline=7.0=h7b6447c_5
- requests=2.21.0=py37_1000
- rtree=0.8.3=py37_1000
- scikit-image=0.14.2=py37hf484d3e_1
- scipy=1.1.0=py37h7c811a0_2
- seaborn=0.9.0=py_0
- send2trash=1.5.0=py_0
- setuptools=40.7.3=py37_0
- shapely=1.6.4=py37h092830f_1002
- sip=4.18.1=py37hf484d3e_1000
- six=1.12.0=py37_1000
- sortedcontainers=2.1.0=py_0
- sqlalchemy=1.2.17=py37h14c3975_0
- sqlite=3.26.0=h7b6447c_0
- statsmodels=0.9.0=py37h3010b51_1000
- tblib=1.3.2=py_1
- terminado=0.8.1=py37_1001
- tk=8.6.8=hbc83047_0
- toolz=0.9.0=py_1
- tornado=5.1.1=py37h14c3975_1000
- traitlets=4.3.2=py37_1000
- tzcode=2018g=h14c3975_1001
- urllib3=1.24.1=py37_1000
- wcwidth=0.1.7=py_1
- webencodings=0.5.1=py_1
- wheel=0.32.3=py37_0
- widgetsnbextension=3.4.2=py37_1000
- xarray=0.11.3=py37_0
- xerces-c=3.2.2=hac72e42_1001
- xorg-kbproto=1.0.7=h14c3975_1002
- xorg-libice=1.0.9=h14c3975_1004
- xorg-libsm=1.2.3=h4937e3b_1000
- xorg-libx11=1.6.7=h14c3975_1000
- xorg-libxau=1.0.8=h14c3975_1006
- xorg-libxdmcp=1.1.2=h14c3975_1007
- xorg-libxext=1.3.3=h14c3975_1004
- xorg-libxrender=0.9.10=h14c3975_1002
- xorg-renderproto=0.11.1=h14c3975_1002
- xorg-xextproto=7.3.0=h14c3975_1002
- xorg-xproto=7.0.31=h14c3975_1007
- xz=5.2.4=h14c3975_4
- yaml=0.1.7=h14c3975_1001
- zeromq=4.2.5=hf484d3e_1006
- zict=0.1.3=py_0
- zlib=1.2.11=h7b6447c_3
- pip:
- affine==2.2.2
- alabaster==0.7.12
- babel==2.6.0
- dash==0.42.0
- dash-core-components==0.47.0
- dash-daq==0.1.5
- dash-html-components==0.16.0
- dash-renderer==0.23.0
- dash-table==3.6.0
- docutils==0.14
- flask==1.0.3
- flask-compress==1.4.0
- hvplot==0.4.0
- imageio-ffmpeg==0.2.0
- imagesize==1.1.0
- itsdangerous==1.1.0
- markdown==3.1
- moviepy==1.0.0
- panel==0.5.1
- plotly==3.9.0
- proglog==0.1.9
- pyopengl==3.1.0
- pyviz==0.10.0
- rasterio==1.0.22
- retrying==1.3.3
- snowballstemmer==1.2.1
- snuggs==1.4.3
- sphinx==2.0.1
- sphinx-rtd-theme==0.4.3
- sphinxcontrib-applehelp==1.0.1
- sphinxcontrib-devhelp==1.0.1
- sphinxcontrib-htmlhelp==1.0.2
- sphinxcontrib-jsmath==1.0.1
- sphinxcontrib-qthelp==1.0.2
- sphinxcontrib-serializinghtml==1.1.3
- testpath==0.3.1
- tqdm==4.31.1
- visvis==1.11.1
- werkzeug==0.15.4
prefix: /home/s2dac/.conda/envs/env3.6
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n_sep=252
PV_col = {1:[-450,401,n_sep],
2:[-450,401,n_sep],
3: [-450,401,n_sep],
5: [-450,401,n_sep],
7: [-450,401,n_sep],
10: [-450,401,n_sep],
20: [-160,161,n_sep],
30: [-80,100,n_sep],
50: [-30,50,n_sep],
70: [-20,300,n_sep],
100: [-10,16,n_sep],
150: [-10,10,n_sep],
200: [-8,10,n_sep],
250: [-8,10,n_sep],
300: [-8,10,n_sep],
400: [-8,10,n_sep],
500: [-12,13,n_sep],
600: [-12,13,n_sep],
700: [-12,13,n_sep],
800: [-12,13,n_sep],
850: [-12,13,n_sep],
900: [-12,13,n_sep],
925: [-12,13,n_sep],
1000: [-12,13,n_sep]}
U_col = {
10:[-40,50,n_sep],
20:[-40,40,n_sep],
30:[-25,32,n_sep],
50:[-20,30,n_sep],
70:[-20,30,n_sep],
100:[-30,50,n_sep],
150:[-30,60,n_sep],
200:[-30,75,n_sep],
500:[-30,50,n_sep],
1000:[-24,24,n_sep]
}
V_col = {
10:[-40,50,n_sep],
20:[-40,40,n_sep],
30:[-25,32,n_sep],
50:[-20,30,n_sep],
70:[-20,30,n_sep],
100:[-30,50,n_sep],
150:[-30,60,n_sep],
200:[-30,75,n_sep],
500:[-30,50,n_sep],
1000:[-24,24,n_sep]
}
T_col = {
20:[212,230,n_sep],
10:[215,245,n_sep],
30:[205,225,n_sep],
50:[200,220,n_sep],
70:[190,218,n_sep],
100:[182,220,n_sep],
150:[202,222,n_sep],
200:[210,230,n_sep],
500:[245,270,n_sep],
1000:[270,310,n_sep]
}
RH_col= {
10:[0,150,n_sep],
20:[0,150,n_sep],
30:[0,150,n_sep],
50:[0,150,n_sep],
70:[0,150,n_sep],
100:[0,150,n_sep],
150:[0,130,n_sep],
200:[0,130,n_sep],
500:[0,105,n_sep],
1000:[0,100,n_sep]
}
W_col= {
10:[-0.02,0.02,n_sep],
20:[-0.04,0.04,n_sep],
30:[-0.05,0.05,n_sep],
50:[-0.09,0.09,n_sep],
70:[-0.1,0.1,n_sep],
100:[-0.3,0.3,n_sep],
150:[-0.4,0.4,n_sep],
200:[-0.6,0.6,n_sep],
500:[-1.0,1.0,n_sep],
1000:[-1.0,1.0,n_sep]
}
# CAT
CAT_col={
400: [0, 0.200,n_sep] ,
500: [0, 0.180,n_sep],
350: [0, 0.250,n_sep],
600: [0, 0.180,n_sep],
700: [0, 0.180,n_sep],
170: [0, 0.230,n_sep],
155: [0, 0.230,n_sep],
140: [0, 0.230,n_sep],
250: [0, 0.230,n_sep],
206: [0, 0.230,n_sep],
301: [0, 0.230,n_sep]
}
# CIT valeur a modifier
CIT_col={
10: [0, 0.025,n_sep] ,
30: [0, 0.025,n_sep],
50: [0, 0.025,n_sep],
70: [0, 0.075,n_sep],
100: [0, 0.06,n_sep],
116: [0, 0.055,n_sep],
128: [0, 0.04,n_sep],
134: [0, 0.03,n_sep],
140: [0, 0.04,n_sep],
147: [0, 0.048,n_sep],
155: [0,0.025,n_sep],
162: [0,0.025,n_sep],
170: [0,0.05,n_sep],
178: [0,0.06,n_sep],
187: [0,0.04,n_sep],
196:[0,0.04,n_sep],
206:[0,0.05,n_sep],
227:[0,0.06,n_sep],
250:[0,0.06,n_sep],
274:[0,0.06,n_sep],
301: [0, 0.075,n_sep],
329:[0, 0.075,n_sep],
350:[0, 0.075,n_sep],
400:[0,0.08,n_sep],
450:[0,0.06,n_sep]
}
# TP= Total Precipitation en mm/h
TP_col= {'sfc':[0.0001,0.5,n_sep]}
# HCCT
HCCT_col= {'sfc':[0,18000,n_sep]}
IR108_col= {'sfc':[195,315,n_sep]}
WV063_col= {'sfc':[195,260,n_sep]}
WV074_col={'sfc':[190,280,n_sep]}
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
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