atmoschem / eixport

Export Emissions to Atmospheric Models
https://atmoschem.github.io/eixport/
Other
27 stars 10 forks source link

set NA as 0 in wrf_put #69

Closed ibarraespinosa closed 3 years ago

ibarraespinosa commented 3 years ago

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

Schuch666 commented 3 years ago

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?

ibarraespinosa commented 3 years ago

I though in adding only x[is.na(x] <- 0

Which emissv function does that? I will take a look

Em seg., 21 de jun. de 2021 às 14:59, Daniel Schuch < @.***> escreveu:

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?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/atmoschem/eixport/issues/69#issuecomment-865233768, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGRM74B2A2B3XVCPUNKFRLDTT54ZHANCNFSM47APSW3A .

Schuch666 commented 3 years ago

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

Schuch666 commented 3 years ago

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

include the option check = TRUE in wrf_put