source: src/compute_metrics_csv.sh @ 176

Last change on this file since 176 was 117, checked in by htune, 7 years ago

updating the Readme file and cleaning the unnecessary files: htune_EmulatingMultiMetric_csv.R, htune_EmulatingSCM.R, htune_EmulatingSCM_CS2.R, htune_csv2Rdata_many-met.R, htune_ncdf2Rdata.R ; adding some python files that allow to draw vertical profiles of different variables for LES and SCMs cf Readme -- Fleur --

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1#!/bin/bash
2
3##############################################################################
4# Computing metrics from LES and SCM
5# Result in csv format
6# Auteur: F Couvreux, R Honnert, F Hourdin, N Villefranque, C Rio, n'co
7##############################################################################
8#
9# metrics are specified in list_case
10# metrics names follow the syntax
11#
12# CASE_SUBCASE_METRICS_T1_T2
13# T1 and T2 are initial and final time step for time averages
14#
15# available METRICS :
16# ===================
17#
18# 1/ zav-400-600-var  -> variable "var" averaged between 400 and 600 m
19#
20# 2/ Ay-var -> integral ( min ( var -var(t=1) ) dz ) / integral ( dz )
21#           integral taken from 0 to  zmax
22#
23# 3/ nebzave, neb2zave, neb4zave : Effective cloud height
24#           = int ( neb^p z dz ) / int ( neb^p dz ) with  p=1, 2 or 4
25#
26# 4/ nebmax : maximum cloud fraction on the column
27#
28# 5/ nebzmin, nebzmax : minimum/maximum cloud height
29#
30# 6/ lwp : liquid water path
31#
32# TBD :
33# =====
34# 1/ integrals are computed assuming rho=1 because rho is not systematically avalble
35# 2/ the time average is coded for zav metrics only
36#
37##############################################################################
38
39nWAVE=1
40
41
42list_case=""
43while (($# > 0)) ; do
44  case $1 in
45    -wave) nWAVE=$2 ; echo WAVE $nWAVE ;  shift ; shift ; echo OPTION $* ;;
46    -help|-h) echo Usage "$0 [-wave N] [metrics1] [metrics2] ..." ; exit ;;
47    *) list_case=( ${list_case[*]} $1 ) ; shift ;;
48  esac
49done
50
51# Default metrics
52if [ $list_case = "" ] ; then list_case=( ARMCU_REF_zav-400-600-theta_9_9 ) ; fi
53       
54wavedir=WAVE$nWAVE
55wave=$nWAVE
56starting=1
57
58# Remove old files
59rm -f metrics_$wave.csv metrics_LES_$wave.csv
60
61for name in ${list_case[@]};do
62  # Where are the reference (target) nc files?
63  if [ ${name:0:3} == RAD ] ; then 
64    REF=RAD
65  else 
66    REF=LES
67  fi
68  for dir in $REF ${wavedir} ; do
69    echo ./extract_onemetric_csv.sh $name $dir
70    ./extract_onemetric_csv.sh $name $dir
71    #========================
72    # Concatenation
73    #========================
74    if [ $dir = $REF ] ; then dirname=REF
75    else dirname=$dir ; fi
76    if [ $starting == 1 ];then
77      cp -f ${dir}_$name.csv metrics_${dirname}_$wave.csv
78    else
79      cut -d, -f2 ${dir}_$name.csv | paste -d, metrics_${dirname}_$wave.csv - > temp
80      mv temp metrics_${dirname}_$wave.csv
81    fi
82  done
83  starting=0
84done # end loop $name
85
86Rscript --vanilla htune_csv2Rdata.R $wave
Note: See TracBrowser for help on using the repository browser.