snowtools 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cenutils/put +278 -0
- snowtools/DATA/EMOS_HN.Rdata +0 -0
- snowtools/DATA/FORCING_test_base.nc +0 -0
- snowtools/DATA/METADATA.xml +18793 -0
- snowtools/DATA/OPER/cron_belenos +49 -0
- snowtools/DATA/OPER/cron_sxcen +4 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC.nam +290 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC_OPER.nam +291 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC_SYTRON.nam +293 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC_reanalysis.nam +289 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC_reanalysis_avalanches.nam +287 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC_reanalysis_forprep.nam +282 -0
- snowtools/DATA/OPTIONS_V8.1_NEW_OUTPUTS_NC_reforecast.nam +287 -0
- snowtools/DATA/OPTIONS_V8_NEW_OUTPUTS_NC.nam +223 -0
- snowtools/DATA/OPTIONS_test_2d.nam +149 -0
- snowtools/DATA/OPTIONS_test_2d_pappus.nam +150 -0
- snowtools/DATA/PGD_test_2d.nc +0 -0
- snowtools/DATA/__init__.py +39 -0
- snowtools/DATA/images.json +14 -0
- snowtools/DATA/interpolate_safran.nam +37 -0
- snowtools/DATA/liste_malgeolocalises.txt +92 -0
- snowtools/DATA/massifs.cpg +1 -0
- snowtools/DATA/massifs.dbf +0 -0
- snowtools/DATA/massifs.prj +1 -0
- snowtools/DATA/massifs.shp +0 -0
- snowtools/DATA/massifs.shx +0 -0
- snowtools/DATA/perturbations_param.txt +10 -0
- snowtools/DATA/reanalyse.ini +10 -0
- snowtools/DATA/sta_skylines.csv +47808 -0
- snowtools/__init__.py +0 -0
- snowtools/conf/S2M_Standard_Metadata.ini +62 -0
- snowtools/conf/extraction_guess_safran.ini +46 -0
- snowtools/conf/extraction_guess_safran_reforecast.ini +23 -0
- snowtools/conf/s2m_alp.ini +162 -0
- snowtools/conf/s2m_alp_allslopes.ini +33 -0
- snowtools/conf/s2m_alp_pp.ini +8 -0
- snowtools/conf/s2m_cor.ini +151 -0
- snowtools/conf/s2m_cor_allslopes.ini +33 -0
- snowtools/conf/s2m_jur.ini +162 -0
- snowtools/conf/s2m_mac.ini +162 -0
- snowtools/conf/s2m_postes.ini +73 -0
- snowtools/conf/s2m_prosnow.ini +23 -0
- snowtools/conf/s2m_pyr.ini +151 -0
- snowtools/conf/s2m_pyr_allslopes.ini +33 -0
- snowtools/conf/s2m_vog.ini +162 -0
- snowtools/conf/s2mdevnew_alp.ini +162 -0
- snowtools/conf/s2mdevnew_cor.ini +151 -0
- snowtools/conf/s2mdevnew_jur.ini +162 -0
- snowtools/conf/s2mdevnew_mac.ini +162 -0
- snowtools/conf/s2mdevnew_postes.ini +73 -0
- snowtools/conf/s2mdevnew_pyr.ini +151 -0
- snowtools/conf/s2mdevnew_vog.ini +162 -0
- snowtools/conf/safran.ini +81 -0
- snowtools/conf/safran_reanalysis.ini +58 -0
- snowtools/conf/safran_reforecast.ini +63 -0
- snowtools/interpolation/DEM.nc +0 -0
- snowtools/interpolation/Makefile +57 -0
- snowtools/interpolation/Makefile_belenos +61 -0
- snowtools/interpolation/Makefile_pc +57 -0
- snowtools/interpolation/Makefile_pc_mag6 +56 -0
- snowtools/interpolation/Netcdf_add_massif_info.py +155 -0
- snowtools/interpolation/ReadMe +33 -0
- snowtools/interpolation/__init__.py +0 -0
- snowtools/interpolation/interpolate_safran.f90 +2341 -0
- snowtools/interpolation/modd_interpol_safran.f90 +28 -0
- snowtools/interpolation/modn_interpol_safran.f90 +68 -0
- snowtools/interpolation/shapefile2NetCDF.py +804 -0
- snowtools/interpolation/shapefile2NetCDF_2D.py +460 -0
- snowtools/plots/__init__.py +0 -0
- snowtools/plots/abstracts/__init__.py +0 -0
- snowtools/plots/abstracts/figures.py +86 -0
- snowtools/plots/boxplots/__init__.py +0 -0
- snowtools/plots/boxplots/boxplots.py +181 -0
- snowtools/plots/compare.py +279 -0
- snowtools/plots/logos/logoMF15.jpg +0 -0
- snowtools/plots/maps/__init__.py +0 -0
- snowtools/plots/maps/cartopy.py +2051 -0
- snowtools/plots/pearps2m/__init__.py +0 -0
- snowtools/plots/pearps2m/postprocess.py +1259 -0
- snowtools/plots/pearps2m/secure_graph_prod.py +21 -0
- snowtools/plots/stratiprofile/Dictionnaries.py +66 -0
- snowtools/plots/stratiprofile/__init__.py +0 -0
- snowtools/plots/stratiprofile/gen_GUI_selfcontain.sh +219 -0
- snowtools/plots/stratiprofile/gui_elements.py +576 -0
- snowtools/plots/stratiprofile/procompare.py +96 -0
- snowtools/plots/stratiprofile/procompare_gui.py +435 -0
- snowtools/plots/stratiprofile/profilPlot.py +539 -0
- snowtools/plots/stratiprofile/proplotter.png +0 -0
- snowtools/plots/stratiprofile/proplotter.py +134 -0
- snowtools/plots/stratiprofile/proplotter_functions.py +402 -0
- snowtools/plots/stratiprofile/proplotter_gui.py +939 -0
- snowtools/plots/stratiprofile/proplotter_test_procedure.md +73 -0
- snowtools/plots/stratiprofile/proreader.py +984 -0
- snowtools/plots/stratiprofile/test_proreader.py +29 -0
- snowtools/plots/temporal/__init__.py +0 -0
- snowtools/plots/temporal/chrono.py +338 -0
- snowtools/plots/temporal/compare_sims.py +112 -0
- snowtools/plots/temporal/demo.py +146 -0
- snowtools/plots/temporal/energybudget.py +275 -0
- snowtools/plots/temporal/escroc_plot.py +245 -0
- snowtools/plots/temporal/impact_comod.py +116 -0
- snowtools/scores/CompareSimuPosteObsCsv.py +640 -0
- snowtools/scores/__init__.py +0 -0
- snowtools/scores/deterministic.py +292 -0
- snowtools/scores/ensemble.py +260 -0
- snowtools/scores/generic.py +70 -0
- snowtools/scores/list_scores.py +128 -0
- snowtools/scripts/ESMSnowMIP/ESM_snowmip.py +163 -0
- snowtools/scripts/ESMSnowMIP/__init__.py +0 -0
- snowtools/scripts/ESMSnowMIP/post_snowmip.py +129 -0
- snowtools/scripts/__init__.py +0 -0
- snowtools/scripts/create_forcing/Template_creation_FORCING.py +213 -0
- snowtools/scripts/create_forcing/__init__.py +0 -0
- snowtools/scripts/create_forcing/forcing_assembly_line.py +166 -0
- snowtools/scripts/extract/__init__.py +0 -0
- snowtools/scripts/extract/bdap/Extraction_BDAP.py +296 -0
- snowtools/scripts/extract/get_pearome4edelweiss.py +65 -0
- snowtools/scripts/extract/obs/__init__.py +0 -0
- snowtools/scripts/extract/obs/bdquery.py +217 -0
- snowtools/scripts/extract/obs/extract_htn_vosges.py +82 -0
- snowtools/scripts/extract/obs/extract_obs.py +99 -0
- snowtools/scripts/extract/obs/extract_obs_allhtn.py +80 -0
- snowtools/scripts/extract/obs/extract_obs_ange.py +80 -0
- snowtools/scripts/extract/obs/extract_obs_chasseneige.py +52 -0
- snowtools/scripts/extract/obs/extract_obs_meteo.py +157 -0
- snowtools/scripts/extract/obs/extract_obs_meteo_mb.py +38 -0
- snowtools/scripts/extract/obs/extract_obs_neigefraiche.py +42 -0
- snowtools/scripts/extract/obs/extract_obs_nivometeo.py +156 -0
- snowtools/scripts/extract/obs/extract_pluvios.py +55 -0
- snowtools/scripts/extract/obs/extract_pluvios_antilope.py +47 -0
- snowtools/scripts/extract/obs/extract_pluvios_clim_antilopeJP1.py +54 -0
- snowtools/scripts/extract/vortex/get_archive_reforecast.py +142 -0
- snowtools/scripts/extract/vortex/get_escroc.py +139 -0
- snowtools/scripts/extract/vortex/get_reanalysis.py +222 -0
- snowtools/scripts/extract/vortex/get_reforecast.py +149 -0
- snowtools/scripts/extract/vortex/vortexIO.py +378 -0
- snowtools/scripts/metadata/__init__.py +0 -0
- snowtools/scripts/metadata/add_newmask.py +54 -0
- snowtools/scripts/metadata/creeMETADATA_postes.py +160 -0
- snowtools/scripts/metadata/extract_mask.py +109 -0
- snowtools/scripts/metadata/extract_metadata.py +68 -0
- snowtools/scripts/metadata/gen_metadata_massif_file.py +84 -0
- snowtools/scripts/post_processing/compute_sentinel2_diagnostics.py +169 -0
- snowtools/tasks/__init__.py +0 -0
- snowtools/tasks/crocO_vortex_kitchen.py +63 -0
- snowtools/tasks/lance_safran.py +87 -0
- snowtools/tasks/oper/__init__.py +0 -0
- snowtools/tasks/oper/ensemble_surfex_tasks_analysis.py +20 -0
- snowtools/tasks/oper/ensemble_surfex_tasks_common.py +536 -0
- snowtools/tasks/oper/ensemble_surfex_tasks_forecast.py +105 -0
- snowtools/tasks/oper/get_monthly_reanalysis.py +173 -0
- snowtools/tasks/oper/get_oper_files.py +394 -0
- snowtools/tasks/oper/iga/__init__.py +0 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_alp.ini +161 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_cor.ini +150 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_jur.ini +161 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_mac.ini +161 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_postes.ini +72 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_pyr.ini +150 -0
- snowtools/tasks/oper/iga/conf/dble/s2m_vog.ini +161 -0
- snowtools/tasks/oper/iga/conf/s2m_alp.ini +168 -0
- snowtools/tasks/oper/iga/conf/s2m_cor.ini +157 -0
- snowtools/tasks/oper/iga/conf/s2m_jur.ini +167 -0
- snowtools/tasks/oper/iga/conf/s2m_mac.ini +167 -0
- snowtools/tasks/oper/iga/conf/s2m_postes.ini +84 -0
- snowtools/tasks/oper/iga/conf/s2m_pyr.ini +156 -0
- snowtools/tasks/oper/iga/conf/s2m_vog.ini +167 -0
- snowtools/tasks/oper/iga/ensemble_surfex_tasks_analysis.py +26 -0
- snowtools/tasks/oper/iga/ensemble_surfex_tasks_bdpe.py +231 -0
- snowtools/tasks/oper/iga/ensemble_surfex_tasks_common.py +524 -0
- snowtools/tasks/oper/iga/ensemble_surfex_tasks_forecast.py +110 -0
- snowtools/tasks/oper/iga/monthly_surfex_reanalysis.py +398 -0
- snowtools/tasks/oper/iga/prepsafran_analyse.py +369 -0
- snowtools/tasks/oper/iga/prepsafran_prevision.py +240 -0
- snowtools/tasks/oper/iga/rapatrie.py +180 -0
- snowtools/tasks/oper/iga/recextfiles.py +23 -0
- snowtools/tasks/oper/iga/recextfiles_monthly.py +21 -0
- snowtools/tasks/oper/iga/safran_analyse_ensemble.py +824 -0
- snowtools/tasks/oper/iga/safran_prevision_ensemble.py +551 -0
- snowtools/tasks/oper/iga_now/conf/s2m_alp.ini +150 -0
- snowtools/tasks/oper/iga_now/conf/s2m_cor.ini +138 -0
- snowtools/tasks/oper/iga_now/conf/s2m_postes.ini +85 -0
- snowtools/tasks/oper/iga_now/conf/s2m_pyr.ini +139 -0
- snowtools/tasks/oper/monthly_surfex_reanalysis.py +413 -0
- snowtools/tasks/oper/monthly_surfex_reanalysis_sytron.py +330 -0
- snowtools/tasks/oper/prepsaf_prosnow.py +147 -0
- snowtools/tasks/oper/prepsafran_analyse.py +358 -0
- snowtools/tasks/oper/prepsafran_prevision.py +254 -0
- snowtools/tasks/oper/prepsafran_reanalyse.py +180 -0
- snowtools/tasks/oper/refill_guess_safran.py +340 -0
- snowtools/tasks/oper/safran_analyse_ensemble.py +881 -0
- snowtools/tasks/oper/safran_prevision_ensemble.py +641 -0
- snowtools/tasks/oper/safran_prosnow.py +383 -0
- snowtools/tasks/research/__init__.py +0 -0
- snowtools/tasks/research/crocO/__init__.py +0 -0
- snowtools/tasks/research/crocO/crocO_common.py +481 -0
- snowtools/tasks/research/crocO/crocO_driver.py +53 -0
- snowtools/tasks/research/crocO/crocO_offline.py +326 -0
- snowtools/tasks/research/crocO/crocO_perturb.py +149 -0
- snowtools/tasks/research/crocO/crocO_soda.py +168 -0
- snowtools/tasks/research/edelweiss/__init__.py +0 -0
- snowtools/tasks/research/edelweiss/make_forcing.py +154 -0
- snowtools/tasks/research/prosnow/__init__.py +0 -0
- snowtools/tasks/research/prosnow/prosnow_LT_forecast.py +493 -0
- snowtools/tasks/research/prosnow/prosnow_LT_hindcast.py +322 -0
- snowtools/tasks/research/prosnow/prosnow_ST_forecast.py +479 -0
- snowtools/tasks/research/prosnow/prosnow_analysis.py +505 -0
- snowtools/tasks/research/prosnow/prosnow_init.py +396 -0
- snowtools/tasks/research/safran/__init__.py +0 -0
- snowtools/tasks/research/safran/prepsaf_reana.py +292 -0
- snowtools/tasks/research/safran/prepsafran_analyse.py +166 -0
- snowtools/tasks/research/safran/prepsafran_reanalysis.py +381 -0
- snowtools/tasks/research/safran/prepsafran_reforecast.py +407 -0
- snowtools/tasks/research/safran/refill_reforecast.py +113 -0
- snowtools/tasks/research/safran/safran_analysis.py +881 -0
- snowtools/tasks/research/safran/safran_reanalysis.py +776 -0
- snowtools/tasks/research/safran/safran_reanalysis_era5.py +654 -0
- snowtools/tasks/research/safran/safran_reforecast.py +568 -0
- snowtools/tasks/research/surfex/__init__.py +0 -0
- snowtools/tasks/research/surfex/crps_task.py +110 -0
- snowtools/tasks/research/surfex/diag_sentinel2.py +119 -0
- snowtools/tasks/research/surfex/ensemble_surfex_reforecast.py +429 -0
- snowtools/tasks/research/surfex/escroc_tasks.py +476 -0
- snowtools/tasks/research/surfex/interpol_task.py +285 -0
- snowtools/tasks/research/surfex/refill_surfex_output.py +619 -0
- snowtools/tasks/research/surfex/scores_task.py +109 -0
- snowtools/tasks/research/surfex/surfex_task.py +985 -0
- snowtools/tasks/runs.py +429 -0
- snowtools/tasks/s2m_command.py +559 -0
- snowtools/tasks/s2m_launcher.py +70 -0
- snowtools/tasks/vortex_kitchen.py +1046 -0
- snowtools/tests/__init__.py +0 -0
- snowtools/tests/export_output.py +18 -0
- snowtools/tests/namelists/namelist_axel_aaron.nam +358 -0
- snowtools/tests/namelists/namelist_base.nam +289 -0
- snowtools/tests/namelists/namelist_impur1.nam +305 -0
- snowtools/tests/namelists/namelist_impur2.nam +305 -0
- snowtools/tests/namelists/namelist_multiphy1.nam +294 -0
- snowtools/tests/namelists/namelist_multiphy2.nam +294 -0
- snowtools/tests/namelists/namelist_multiphy3.nam +294 -0
- snowtools/tests/namelists/namelist_pappus_1.nam +291 -0
- snowtools/tests/namelists/namelist_prep_impur.nam +317 -0
- snowtools/tests/namelists/namelist_resort1.nam +300 -0
- snowtools/tests/namelists/namelist_snowdrift1.nam +295 -0
- snowtools/tests/namelists/namelist_snowdrift2.nam +295 -0
- snowtools/tests/namelists/namelist_snowdrift3.nam +295 -0
- snowtools/tests/s2m_instance.py +31 -0
- snowtools/tests/tempfolder.py +90 -0
- snowtools/tests/test_Netcdf_add_massif_info.py +30 -0
- snowtools/tests/test_cartopy_plots.py +417 -0
- snowtools/tests/test_cartopy_plots_index_template.html +204 -0
- snowtools/tests/test_comp_surfex.py +78 -0
- snowtools/tests/test_dev_surfex.py +178 -0
- snowtools/tests/test_postprocess.py +42 -0
- snowtools/tests/test_prosimu.py +253 -0
- snowtools/tests/test_s2m.py +60 -0
- snowtools/tests/test_script_create_forcing.py +74 -0
- snowtools/tests/test_soda/OBSERVATIONS_140225H06.nc +0 -0
- snowtools/tests/test_soda/OPTIONS.nam +341 -0
- snowtools/tests/test_soda/PGD.nc +0 -0
- snowtools/tests/test_soda/PREP.nc +0 -0
- snowtools/tests/test_soda/__init__.py +0 -0
- snowtools/tests/test_soda/test_soda.sh +34 -0
- snowtools/tools/VizForEnsemble.py +111 -0
- snowtools/tools/__init__.py +0 -0
- snowtools/tools/change_forcing.py +1157 -0
- snowtools/tools/change_prep.py +248 -0
- snowtools/tools/combine_memberfiles.py +139 -0
- snowtools/tools/emosCSG.py +268 -0
- snowtools/tools/execute.py +70 -0
- snowtools/tools/get_requirements.sh +26 -0
- snowtools/tools/initTG.py +150 -0
- snowtools/tools/massif_diags.py +107 -0
- snowtools/tools/param_baseline.txt +11 -0
- snowtools/tools/perturb_forcing.py +322 -0
- snowtools/tools/read_conf.py +154 -0
- snowtools/tools/special_diags.py +55 -0
- snowtools/tools/update_namelist.py +362 -0
- snowtools/utils/ESCROCsubensembles.py +657 -0
- snowtools/utils/FileException.py +338 -0
- snowtools/utils/Met2Netcdf.py +665 -0
- snowtools/utils/S2M_standard_file.py +464 -0
- snowtools/utils/__init__.py +0 -0
- snowtools/utils/dates.py +264 -0
- snowtools/utils/git.py +421 -0
- snowtools/utils/infomassifs.py +519 -0
- snowtools/utils/obscsv.py +157 -0
- snowtools/utils/operational_reproductibility/__init__.py +0 -0
- snowtools/utils/operational_reproductibility/compare2versions.py +626 -0
- snowtools/utils/operational_reproductibility/extractallproducts.py +121 -0
- snowtools/utils/prosimu.py +1029 -0
- snowtools/utils/read_snowpack.py +361 -0
- snowtools/utils/resources.py +317 -0
- snowtools/utils/shapefile.py +1168 -0
- snowtools/utils/skyline/__init__.py +0 -0
- snowtools/utils/skyline/skyline_bdclim.py +220 -0
- snowtools/utils/sun.py +440 -0
- snowtools-2.0.1.dist-info/LICENCE-en.txt +517 -0
- snowtools-2.0.1.dist-info/LICENCE.txt +521 -0
- snowtools-2.0.1.dist-info/METADATA +623 -0
- snowtools-2.0.1.dist-info/RECORD +304 -0
- snowtools-2.0.1.dist-info/WHEEL +5 -0
- snowtools-2.0.1.dist-info/entry_points.txt +4 -0
- snowtools-2.0.1.dist-info/top_level.txt +2 -0
cenutils/put
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
#######################################################################
|
|
7
|
+
# Help #
|
|
8
|
+
#######################################################################
|
|
9
|
+
|
|
10
|
+
function usage()
|
|
11
|
+
{
|
|
12
|
+
echo "Script to synchronize the codes between your computer"
|
|
13
|
+
echo "and servers (vortex, snowtools, other codes)"
|
|
14
|
+
echo ""
|
|
15
|
+
echo "$0 [options] folder server"
|
|
16
|
+
echo ""
|
|
17
|
+
echo -e "options:"
|
|
18
|
+
echo -e "\t-h --help : help"
|
|
19
|
+
# echo -e "\t--no-delete : Do not delete files on destination (not implemented)"
|
|
20
|
+
echo -e "\t-f --force : Do not ask for confirmation"
|
|
21
|
+
echo -e "\t--ftp : Use lftp/mirror to transfer files instead of rsync"
|
|
22
|
+
echo -e ""
|
|
23
|
+
echo -e "folder:"
|
|
24
|
+
echo -e "\tThe code folder to synchronize"
|
|
25
|
+
echo -e "\tAlso accept 'snowtools', 'surfex' and 'vortex' if"
|
|
26
|
+
echo -e "\tenvironment variables SNOWTOOLS_CEN, EXESURFEX and"
|
|
27
|
+
echo -e "\tVORTEX are defined"
|
|
28
|
+
echo -e ""
|
|
29
|
+
echo -e "server:"
|
|
30
|
+
echo -e "\tThe server on which the code should be sent"
|
|
31
|
+
echo -e ""
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#######################################################################
|
|
35
|
+
# Colored terms #
|
|
36
|
+
#######################################################################
|
|
37
|
+
|
|
38
|
+
if [[ -t 1 ]]
|
|
39
|
+
then
|
|
40
|
+
GREEN="\033[32m"
|
|
41
|
+
ORANGE="\033[1;33m"
|
|
42
|
+
RED="\033[1;31m"
|
|
43
|
+
STOPC="\033[0m"
|
|
44
|
+
else
|
|
45
|
+
GREEN=""
|
|
46
|
+
ORANGE=""
|
|
47
|
+
RED=""
|
|
48
|
+
STOPC=""
|
|
49
|
+
fi
|
|
50
|
+
|
|
51
|
+
#######################################################################
|
|
52
|
+
# Parsing arguments #
|
|
53
|
+
#######################################################################
|
|
54
|
+
FOLDER='x'
|
|
55
|
+
SERVER='x'
|
|
56
|
+
FORCE=0
|
|
57
|
+
METHOD='Rsync'
|
|
58
|
+
while [[ $# -gt 0 ]]
|
|
59
|
+
do
|
|
60
|
+
key="$1"
|
|
61
|
+
|
|
62
|
+
case $key in
|
|
63
|
+
-h|--help)
|
|
64
|
+
usage
|
|
65
|
+
exit 0
|
|
66
|
+
;;
|
|
67
|
+
-f|--force)
|
|
68
|
+
FORCE=1
|
|
69
|
+
shift
|
|
70
|
+
;;
|
|
71
|
+
--ftp)
|
|
72
|
+
METHOD='LFTP'
|
|
73
|
+
shift
|
|
74
|
+
;;
|
|
75
|
+
-*)
|
|
76
|
+
echo -e "${RED}ERROR${STOPC}: Unknown argument $1"
|
|
77
|
+
echo ""
|
|
78
|
+
usage
|
|
79
|
+
exit 3
|
|
80
|
+
;;
|
|
81
|
+
*) # Folder or server
|
|
82
|
+
if [ "$FOLDER" = "x" ]
|
|
83
|
+
then
|
|
84
|
+
FOLDER="$1"
|
|
85
|
+
else
|
|
86
|
+
SERVER="$1"
|
|
87
|
+
fi
|
|
88
|
+
shift # shift to next argument
|
|
89
|
+
;;
|
|
90
|
+
esac
|
|
91
|
+
done
|
|
92
|
+
|
|
93
|
+
#######################################################################
|
|
94
|
+
# Check arguments #
|
|
95
|
+
#######################################################################
|
|
96
|
+
# We need at least folder and server
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if [ "$SERVER" = "x" ]
|
|
100
|
+
then
|
|
101
|
+
echo -e "${RED}ERROR${STOPC}: Argument server not provided"
|
|
102
|
+
echo ""
|
|
103
|
+
usage
|
|
104
|
+
exit 3
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# Check FOLDER : is it a known repository ? Or a valid folder ?
|
|
108
|
+
|
|
109
|
+
case $FOLDER in
|
|
110
|
+
x)
|
|
111
|
+
echo -e "${RED}ERROR${STOPC}: Argument folder not provided"
|
|
112
|
+
echo ""
|
|
113
|
+
usage
|
|
114
|
+
exit 3
|
|
115
|
+
;;
|
|
116
|
+
vortex)
|
|
117
|
+
if [ ! -d "$FOLDER" ]
|
|
118
|
+
then
|
|
119
|
+
FOLDER="$VORTEX"
|
|
120
|
+
fi
|
|
121
|
+
;;
|
|
122
|
+
snowtools)
|
|
123
|
+
if [ ! -d "$FOLDER" ]
|
|
124
|
+
then
|
|
125
|
+
FOLDER="$SNOWTOOLS_CEN"
|
|
126
|
+
fi
|
|
127
|
+
;;
|
|
128
|
+
surfex)
|
|
129
|
+
if [ ! -d "$FOLDER" ]
|
|
130
|
+
then
|
|
131
|
+
FOLDER=`dirname $EXESURFEX`
|
|
132
|
+
fi
|
|
133
|
+
;;
|
|
134
|
+
esac
|
|
135
|
+
|
|
136
|
+
if [ ! -d "$FOLDER" ]
|
|
137
|
+
then
|
|
138
|
+
echo -e "${RED}ERROR${STOPC}: Folder $FOLDER is incorrect"
|
|
139
|
+
echo ""
|
|
140
|
+
usage
|
|
141
|
+
exit 3
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
# Pre-processing of FOLDER variable : remove $HOME at begining
|
|
145
|
+
FOLDER=`realpath "$FOLDER"`
|
|
146
|
+
if $(echo `realpath SURFEX` | grep -q "^$HOME")
|
|
147
|
+
then # The folder to treat is a subfolder of $HOME : OK
|
|
148
|
+
FOLDER_FROM_HOME=`echo "$FOLDER" | sed -e "s#^$HOME/##"`
|
|
149
|
+
else
|
|
150
|
+
echo -e "${RED}ERROR${STOPC}: This script is not designed to deal with folders that are not in your home !"
|
|
151
|
+
echo "Provided folder $FOLDER is not in your home."
|
|
152
|
+
echo ""
|
|
153
|
+
exit 3
|
|
154
|
+
fi
|
|
155
|
+
|
|
156
|
+
#######################################################################
|
|
157
|
+
# File transfer #
|
|
158
|
+
#######################################################################
|
|
159
|
+
|
|
160
|
+
folder_dest=$FOLDER_FROM_HOME
|
|
161
|
+
folder_orig=$HOME/$FOLDER_FROM_HOME/
|
|
162
|
+
|
|
163
|
+
# Confirmation
|
|
164
|
+
if [ $FORCE -eq 0 ]
|
|
165
|
+
then
|
|
166
|
+
echo "> $METHOD transfer folder ~/$FOLDER_FROM_HOME on $SERVER (~/$folder_dest)"
|
|
167
|
+
read -p "Is this correct [Y/n] ? " -n 1 -r CHOICE
|
|
168
|
+
echo ""
|
|
169
|
+
if [[ $CHOICE =~ ^[nN]$ ]]
|
|
170
|
+
then
|
|
171
|
+
echo -e "Aborting."
|
|
172
|
+
exit 0
|
|
173
|
+
fi
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# Git management : transfer a minimal information on git status
|
|
177
|
+
# on the destination in the ofr of a simple .git_info file.
|
|
178
|
+
GIT_INFO_ADDED=1
|
|
179
|
+
pushd $folder_orig > /dev/null
|
|
180
|
+
if [ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = "true" ]
|
|
181
|
+
then
|
|
182
|
+
GIT_PRETTYLOG=`git log -1 --date=format:'%Y-%m-%d' --format='%h (%cd)'`
|
|
183
|
+
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
|
184
|
+
if git status --porcelain --untracked-files=no | grep -q 'M'
|
|
185
|
+
then
|
|
186
|
+
GIT_MODIFIED=' +'
|
|
187
|
+
else
|
|
188
|
+
GIT_MODIFIED=''
|
|
189
|
+
fi
|
|
190
|
+
GIT_STR="$GIT_PRETTYLOG $GIT_BRANCH$GIT_MODIFIED"
|
|
191
|
+
echo "$GIT_STR" > "${folder_orig}/.git_info"
|
|
192
|
+
GIT_INFO_ADDED=0
|
|
193
|
+
fi
|
|
194
|
+
popd > /dev/null
|
|
195
|
+
|
|
196
|
+
# Actual transfer
|
|
197
|
+
if [ "$METHOD" = "Rsync" ]
|
|
198
|
+
then
|
|
199
|
+
set +e
|
|
200
|
+
# --delete-excluded --force (force deletion of dirs even if not empty)
|
|
201
|
+
rsync -av --links --delete \
|
|
202
|
+
--exclude .git \
|
|
203
|
+
--exclude .idea \
|
|
204
|
+
--exclude .settings \
|
|
205
|
+
--exclude "venv*" \
|
|
206
|
+
--exclude "*.pyc" --exclude "*.bak" --exclude "*.sav" --exclude "*.backup" \
|
|
207
|
+
--exclude ".*.swp" --exclude "*~" \
|
|
208
|
+
--exclude "*.egg-info" --exclude "*.o" --exclude "*.bin" --exclude "*.exe" \
|
|
209
|
+
--exclude fail_test --exclude Manual_tests --exclude "interpolation/*.mod" \
|
|
210
|
+
--exclude "interpolation/interpol_*" \
|
|
211
|
+
--exclude /exe --exclude "src/dir_obj*" --exclude "exe_*" \
|
|
212
|
+
--exclude 'profile_surfex' --exclude 'profile_surfex-LX*' \
|
|
213
|
+
--exclude "src/LIB/grib_api-*-Source" --exclude "src/LIB/eccodes*" --exclude STRATO \
|
|
214
|
+
$folder_orig $SERVER:$folder_dest
|
|
215
|
+
retcode=$?
|
|
216
|
+
set -e
|
|
217
|
+
elif [ "$METHOD" = "LFTP" ]
|
|
218
|
+
then
|
|
219
|
+
user=`id -u -n`
|
|
220
|
+
set +e
|
|
221
|
+
lftp -c "set ftp:list-options -a;
|
|
222
|
+
open -u $user@$SERVER -p 8021 ftp://137.129.13.180;
|
|
223
|
+
set ftp:passive-mode false;
|
|
224
|
+
set cmd:fail-exit true;
|
|
225
|
+
set ftp:use-utf8 false;
|
|
226
|
+
# Par defaut les logs sont dans ~/.local/share/lftp/transfer_log
|
|
227
|
+
set log:show-pid true;
|
|
228
|
+
set mirror:sort-by name;
|
|
229
|
+
set mirror:overwrite true;
|
|
230
|
+
lcd ./ ;
|
|
231
|
+
cd $HOME;
|
|
232
|
+
mirror --reverse \
|
|
233
|
+
--delete --use-cache --verbose \
|
|
234
|
+
--allow-chown --allow-suid --no-umask --parallel=2 \
|
|
235
|
+
--exclude .git/ \
|
|
236
|
+
--exclude .idea/ \
|
|
237
|
+
--exclude .settings/ \
|
|
238
|
+
--exclude fail_test \
|
|
239
|
+
--exclude Manual_tests \
|
|
240
|
+
--exclude interpolation/interpol_MPIAUTO \
|
|
241
|
+
--exclude exe/ \
|
|
242
|
+
--exclude-glob exe_*/ \
|
|
243
|
+
--exclude 'profile_surfex' \
|
|
244
|
+
--exclude-glob interpolation/*.mod \
|
|
245
|
+
--exclude-glob venv* \
|
|
246
|
+
--exclude-glob *.pyc \
|
|
247
|
+
--exclude-glob *.bak \
|
|
248
|
+
--exclude-glob *.sav \
|
|
249
|
+
--exclude-glob *.backup \
|
|
250
|
+
--exclude-glob .*.swp \
|
|
251
|
+
--exclude-glob *~ \
|
|
252
|
+
--exclude-glob *.egg-info \
|
|
253
|
+
--exclude-glob *.o \
|
|
254
|
+
--exclude-glob *.bin \
|
|
255
|
+
--exclude-glob *.exe \
|
|
256
|
+
--exclude-glob src/dir_obj*/ \
|
|
257
|
+
--exclude-glob 'profile_surfex-LX*' \
|
|
258
|
+
--exclude-glob src/LIB/grib_api-*-Source/ \
|
|
259
|
+
--exclude-glob src/LIB/eccodes*/ \
|
|
260
|
+
--exclude-glob src/LIB/eccodes* \
|
|
261
|
+
--exclude STRATO \
|
|
262
|
+
$folder_orig $folder_dest"
|
|
263
|
+
retcode=$?
|
|
264
|
+
set -e
|
|
265
|
+
fi
|
|
266
|
+
|
|
267
|
+
# Cleaning eventual git file added
|
|
268
|
+
if [ $GIT_INFO_ADDED -eq 0 ]
|
|
269
|
+
then
|
|
270
|
+
rm "${folder_orig}/.git_info"
|
|
271
|
+
fi
|
|
272
|
+
|
|
273
|
+
if [ $retcode -eq 0 ]
|
|
274
|
+
then
|
|
275
|
+
echo -e "${GREEN}OK${STOPC}: Transfer successful."
|
|
276
|
+
else
|
|
277
|
+
echo -e "${RED}ERROR${STOPC}: An error occured during code synchronization. Please refer to output log above. (Return code $retcode)"
|
|
278
|
+
fi
|
|
Binary file
|
|
Binary file
|