Articles

Affichage des articles du 2025

What was stored in a .Rdata file

 If you load the .Rdata in an environment with already many data, it can be difficult to know what is new after the loading. The solution is to use: print(load("yourobject.Rdata"))

Read ECMWF data ERA 5

ERA5 is the latest development in the ERA series, and  improves significantly on its predecessors by: - Offering a higher horizontal resolution of 31 km and 137 vertical levels from the surface up to 0.01 hPa (around 80 km); - Using a more recent and advanced version of the ECMWF IFS model; - Providing hourly estimates of atmospheric variables; - Providing a consistent representation of uncertainties for these variables; - Using more satellite observations in the data assimilation. Here are some information to access this database using python batch Please visit http://climate.copernicus.eu/climate-reanalysis for more information including documentation and guidelines on how to download the data. __________ June 2025 The new ECMWF methodology cannot use R directly. The solution I found to download data in MacOSX was: https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview To install the CDSAPI using pip, the solution is to create a virtual environneme...

Compile gam on R 4.6.0

 Error because library libintl.h is not found; to solve: sudo ln -s /opt/homebrew/Cellar/gettext/0.25/include/libintl.* /opt/R/arm64/include

Force to show all labels in axis

 atT <- structure(c(1672520400, 1675198800, 1677618000, 1680296400, 1682888400,              1685566800, 1688158800, 1690837200, 1693515600, 1696107600, 1698786000,              1701378000, 1704056400, 1706734800, 1709240400, 1711918800, 1714510800,              1717189200, 1719781200, 1722459600, 1725138000, 1727730000, 1730408400,              1733000400, 1735678800), class = c("POSIXct", "POSIXt"), tzone = "Asia/Riyadh") # Work as expected plot(x = atT, y=rep(1, length(atT)), xaxt="n") axis(side = 1, at=atT, labels = as.character(seq_along(atT)))    # Only first label is shown plot(x = atT, y=rep(1, length(atT)), xaxt="n") axis(1, at=atT, label=c("Jan-2023", "", "", "", "", "", "Jul-2023", "", "", "", "", "",                                  ...

Likelihood of bivariate Gaussian distribution

Let X, one observation composed of two values (x1, x2) obtained from Gaussian distributions µ1, s1 and µ2, s2 with rho being a correlation coefficient between Gaussian distributions 1 and 2, the likelihood is: library(mvtnorm) dmvnorm(x=c(x1,x2), mean=c(µ1,µ2), sigma=matrix(c(s1, rho, rho, s2), ncol=2))

Options for svg graphics in RMarkdown

 These options seem to be ok: ```{r setup, include=TRUE} knitr::opts_chunk$set(fig.path='figs/xxx_',                        dev='svg',                        concordance=TRUE,                        echo=TRUE,                        fig.width=12, fig.height=8,                        dev.args=list(pointsize=16)) ```

Error when gfortran is used for package installation from source

 MacOSX 15.3 gcc installed using MacBrew I get this error: ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found ld: warning: search path '/opt/gfortran/lib' not found ld: library 'gfortran' not found I solve it by creating a  ~/.R/Makevars  file like this: FC      = /opt/homebrew/opt/gfortran/bin/gfortran F77     = /opt/homebrew/opt/gfortran/bin/gfortran FLIBS   = -L/opt/homebrew/opt/gfortran/lib Now I can compile package with gfortran

optimx error in MacOsX

 Since this morning (5/2/2025), I get an error when I try to load optimx package: > library("optimx") Erreur : le chargement du package ou de l'espace de noms a échoué pour ‘optimx’ in dyn.load(file, DLLpath = DLLpath, ...) : impossible de charger l'objet partagé '/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nloptr/libs/nloptr.so' :   dlopen(/Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nloptr/libs/nloptr.so, 0x0006): Library not loaded: /opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib   Referenced from: <2A7DAFE2-8123-3555-9569-F28214328E47> /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/nloptr/libs/nloptr.so   Reason: tried: '/opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib' (no such file), '/opt/homebrew/opt/nlopt/lib/libnlopt.0.dylib' (no such file), '/Libra...

Degree symbol in plot

main = expression("Temperature ("*~degree*C*")") main = "Temperature (°C)" main = "Temperature (\u00B0C)" with expression format, the font is lighter. I don't know why.