############################################################################### # Auteurs : Najda Villefranque # Modif 2017/12/15 : F. Hourdin # Reads z-t files from LES and SCM stored in DATA/ # SMC001.nc, SCM002.nc, ... and same for LES # Calcule les metriques. Plusieurs options a completer # Modif 2018/08/17 : N. Villefranque # Added radiation metrics # Do not call plot_setup # zmax is now an argument of get_metric ############################################################################### library("ncdf4") # to manipulate ncdf # I comment this because I think it is better to keep independent modules # I think zmax should be given as a parameter to get_metric #pltsu<-plot_setup(case_name,plotvar) #zmax=pltsu[3] ############################################################################# # Compute the height of maximum nebulosity ############################################################################# compute_zhneb <- function(zval,neb,zmax,varname) { lm=dim(neb)[2] km=dim(neb)[1] # nebzave, neb2zave, neb4zave # Computes the mean altitude of clouds as the integral on the vertical # of the altitude times a wheight f**np where np is a positive integer # For large values of np, the altitude is that of the maximum cloud fraction if ( ( varname == "nebzave" ) | ( varname == "neb2zave" ) | ( varname == "neb4zave" ) ) { if ( varname == "nebzave" ) {pn=1} else { if (varname == "neb2zave") {pn=2} else {pn=4} } rm=rep(0,lm) hm=rep(0,lm) nebzave=rep(0,lm) # finding for (k in 2:km-1) { if (zval[k+1] eff_ratio*nebmax[l] ) { nebzmin[l]=min(nebzmin[l],zval[k]) nebzmax[l]=max(nebzmax[l],zval[k]) } } } if ( nebzmin[l] == 99999999. ) { nebzmin[l]=0. } if ( nebzmax[l] == -1. ) { nebzmax[l]=0. } } if ( varname == "nebzmin" ) { return(nebzmin) } else { if ( varname == "nebzmax" ) { return(nebzmax) } else { print(c("variable ",varname," non prevue")) } } } } } ############################################################################# # Compute liquid water path ############################################################################# compute_Ay <- function(zval,vvv,zmax,varname) { # Computes the mean altitude of clouds lm=dim(vvv)[2] km=dim(vvv)[1] rm=matrix(0.,lm) hm=matrix(0.,lm) Ay=matrix(0.,lm) evol<-matrix(0.,km,lm) if ( substr(varname,1,5) == "theta" ) { for (l in 1:lm) { for (k in 1:km) { evol[k,l]=min(vvv[k,l]-vvv[k,1],0.) } } } else { for (l in 1:lm) { for (k in 1:km) { evol[k,l]=max(vvv[k,l]-vvv[k,1],0.) } } } # finding for (l in 1:lm) { rm[l]=0. hm[l]=0. for (k in 2:km-1) { if (zval[k+1]