atmoschem/eixport

set NA as 0 in wrf_put

ibarraespinosa opened this issue · 4 comments

Eventually, it can be inputted an array with NA into a wrfchemi. This silently results in a max number of xx+e35 on the resulting NetCDF (depending on the Machine, I guess). Then, all NA should be replaced by 0, with a message

Hi,

I can add an option to include a test in this process, but NAs are fully suported by NetCDF and R. In case of a NA is used the library will choose the default value, I'm not sure if it make any difference (running the model using emissions with NAs or replacing by zeros).

A important check is to check is negative values are present (in this case it can cause some wrong results and maybe lead to errors).

I already have it ready (with support for units) in EmissV and can I include it here, what do you think?

Yes it can be simple, including something like:

x[is.na(x)] <- 0 # for NAs
x[x < 0]    <- 0  # to check negative values

There a internal function in EmissV: https://github.com/atmoschem/EmissV/blob/ece6e7e7b13819d3d7c0253365e70165a91603da/R/emission.R#L210

Included an option to check for NA and negative values in wrf_put:

include the option check = TRUE in wrf_put