WRF/Chem: Editing NetCDF (wrfchemi files) for own emissions Does anybody here have any experience with editing wrfchemi outputs from the prep_chem utility so that I overwrite the file with my own emissions?

I am knowledgeable in python, but I am not that well oriented with the manipulation of NetCDF files. 

What I want to do, basically, is to use my own emissions inside the WRF/Chem model


I have a shapefile of emissions (gridded) with each grid having a value for the emissions.
I want to convert this to a readable format for the WRF/Chem; however, I think editing the wrfchemi files by prep_chem would be easier? (Tell me if not)


I have read the emissions guide of the WRF/Chem, but it does not really expound on details about this especially about the following


How to deal with the speciation (my shapefile has only PM10 and PM2.5). where exactly do I place this in the new emissions file (the edited wrfchemi)I want. There are many pm species there (like pm2.5 nucleation mode, pm, etc). I am not sure what weights to put on these.
My emissions are not time dependent, and what do I do when I edit the wrfchemi file for this. (the wrfchemi files I have now are also not time dependent)


Hoping someone could help out with this.

Thanks!
You can try the R package eixport, with wrf_put

# example
# Read the array emissions,
CO &lt;- wrf_get(file = "Path_to_WRFCHEMI", name = "E_CO")
# Change the values, here you should use your data
CO[] = rnorm(length(CO))
# Inyect your emissions into the wrfchemi
wrf_put(file = "Path_to_WRFCHEMI", name = "E_CO", POL = CO)



  How to deal with the speciation (my shapefile has only PM10 and
  PM2.5). where exactly do I place this in the new emissions file (the
  edited wrfchemi)I want. There are many pm species there (like pm2.5
  nucleation mode, pm, etc). I am not sure what weights to put on these.


You need to know the speciation for your local. At my department at Uni. of São Paulo, we use the following speciation of PM 2.5 (g/h/km^2)

e_so4i = 0.0077, e_so4j = 0.0623, e_no3i = 0.00247, e_no3j = 0.01053, e_pm2.5i = 0.1, e_pm2.5j = 0.3, e_orgi = 0.0304, e_orgj = 0.1296, e_eci = 0.056, e_ecj = 0.024, h2o = 0.277

Check this


  My emissions are not time dependent, and what do I do when I edit the
  wrfchemi file for this. (the wrfchemi files I have now are also not
  time dependent)


You need to first edit the namelist.wps and namelist.input to the desired length of time. Then, after running  ./real.exe you will have the wrfinput_d0x. At this stage you can use wrf_create which creates a wrfchemi file with 0. Read the manual to see if you want two 0-12z 12-0z files or one file with the length for all hours. Then you can use wrf_put. Just follow the example and read the manual.

You might also try the R package EmissV

References:


Ibarra-Espinosa et al., (2018). eixport: An R package to export
emissions to atmospheric models. Journal of Open Source Software,
3(24), 607, https://doi.org/10.21105/joss.00607 Schuch et al.,
(2018). 
EmissV: an R package to create vehicular and other emissions
for air quality models. Journal of Open Source Software, 3(30), 662,
https://doi.org/10.21105/joss.00662