Processing RCP emissions in SMOKE

Ernesto,

Smkinven has a flag called "NETCDF_POL_UNIT” to specify the unit of the EDGAR pollutants, set to kg m-2 s-1 which is consistent to your setting.

Also, you have an option how to process your inventory as monthly or annual based on your knowledge. You can tell Smkinven how to handle them by how you setup the Smkinven inventory list input file (ARINV). Here is the format shown below. You need to put either specific month (i.e., 1, 2, 3,12) if your inventory file is monthly. If it is annual, then set it to 0.

#SCC, Pollutant, Variable_Name, Month, File_location_name
SOLVENT,VOC,emis_nmvoc,0,/nas/EDGAR/solvent/nmvoc/v42_2010.nc
SOLVENT,CH4,emis_ch4,0,/nas/EDGAR/solvent/ch4/v42_2010.nc
ENERGY,NOX ,emis_nox,0,/nas/EDGAR/energy/nox/v42_2010.nc
ENERGY,PM25,emis_pm25,0,/nas/EDGAR/energy/pm2.5/v42_2010.nc
ENERGY,NOX,emis_nmvoc,0,/nas/EDGAR/energy/nmvoc/v42_2010.nc

Hello Baek:
Yes, I know what you want to tell me. But my question is, What happen if the netcdf file (containing emission inventory) has the variable “time step” inside.
The information you gave me is considering monthly files (the sum of monthly emission) but not considering the variable “time step” inside.
I remember, from SMOKE4.5 tutorial, that we have to give to SMKINVEN gridded netCDF files time independent. Am I correct???
Thanks for your time

In my case, I am trying to use an anual inventory file, but with daily emission information inside.

Hi Ernesto,

Unfortunately, current version of SMOKE does not support the time step in netCDF file. We may update the system to support that in the future but unfortunately there is no specific plan for that feature at this moment. Sorry. :frowning:

Not problem. I hope to use any tool to extract the “time step” variable from netCDF files. Until today, I do not find it.
Thanks for your time

While I was working on another project, Dr. Coats (IOAPI author) and I updated the IOAPI library to read and process raw NetCDF files including RCP and EDGAR pregridded inventory files. Once you install the latest version of IOAPI, you can tap into new module called “MODNCFIO”. You can read all attributes from the netcdf files quite easily. Here is the detail information about the module in IOAPI. You can develop a tool you need using these functions already available in IOAPI module.

https://www.cmascenter.org/ioapi/documentation/all_versions/html/MODNCFIO.html

1 Like

I saw the POL_HEMI grid parameters in the GRIDDESC file for EDGAR data:

! coords --line: name; type, P-alpha, P-beta, P-gamma, xcent, ycent
’POL_HEMI’
6, 1.D0, 45.D0, -98.D0, -98.D0, 90.D0
’ ’ ! end coords. grids: name; xorig,yorig,xcell,ycell,ncols,nrows,nthik
’HEMI_108k’
’POL_HEMI’, -10098D3, -10098D3, 108.D3, 108.D3, 187, 187, 1
’ ’ ! end grids.

However, I am not sure I can accurately give the values of all the parameters like P-alpha, P-beta, etc to describe the grid+projection for RCP data that I downloaded. How should I proceed here?

You need to find out the detail spatial domain information for your gridded inventory files before you move forward. If your modeling domain is different than what I provided you, then you need to generate your own GRIDMASK input file for a proper spatial and temporal allocations processing through SMOKE.

Running MCIP also gives a GRIDDESC file for the WRF meteorological input, I assume.

What are possible ways of converting CSV files to IO/API format in (1) linux, and (2) windows environments? It looks like I will have to do the conversion during RCP emissions preprocessing for SMOKE.

Hi,

The specifics of what needs to be done depend upon what is in the CSV file. The easiest way starts with a pre-existing IO/API file, but that isn’t strictly necessary. The code below is just something a colleague threw together very quickly – it is probably not complete but it should be close:

– START PYTHON CODE

import pandas as pd

import PseudoNetCDF as pnc

pathtoexistingemisfile = ‘/path/to/ioapi.nc’

outpath = ‘test.nc’

pathtocsv = ‘/path/to/RCP.csv’

read and copy an existing file

iofile = pnc.pncopen(pathtoexistingemisfile).copy()

zero out

for k, v in iofile.variables.items():

if k != ‘TFLAG’:

v[:] = 0.

Assuming a specific structure of columns and spatial/temporal consistency

Datetime_UTC in the form YYYY-MM-DD HH:MM:SS+0000

Latitude in the form of decimal degrees north

Longitude in the form of decimal degrees east

Species in the form of the name expected by CMAQ

Value in the unit expected by CMAQ

csvdata = pd.read_csv(pathtocsv, parse_dates=[‘Datetime_UTC’])

Convert lon/lat to i/j

i, j = iofile.ll2ij(csvdata[‘Longitude’], csvdata[‘Latitude’])

csvdata[‘I’] = csvdata[‘Longitude’].astype(‘i’) * 0 + i

csvdata[‘J’] = csvdata[‘I’] * 0 + j

Group on date/i/j/spc and sum masses

grouped = csvdata.groupby([‘Species’, ‘Datetime_UTC’, ‘I’, ‘J’]).sum()

times = iofile.getTimes()

for ridx, row in grouped.iterrows():

spck, date, i, j = ridx

h = ((date - times[0]).total_seconds() // 3600).astype(‘i’)

iofile.variables[spck][h, 0, j, i] = row[‘Value’]

iofile.save(outpath, format=‘NETCCDF_CLASSIC’)

– END PYTHON CODE

Hello Dr Baek.
Here I am again. I have been bussy trying to change netCDF format to use in SMOKE, similar to EDGAR files.
Now, I have a way to proceess that kind of file, and it worth perfect. Now, I am wondering if I can extract daily inventory files (netCDF files) instead monthly inventory as you told me before.
I am trying to obtain fire emissions from global inventory data. So, the most correctly way is to process it as daily emissions.
It is possible to put in arinv file daily emissions from netCDF file?
Thanks

I am not sure what is the best option for this but current version can not process daily netcdf gridded inventory files. Not sure it will work or not but you can run daily netCDF inventory file as ARINV everyday. It means you need to switch the daily netcdf file everyday. With this option, you need to be careful about the time zone shift of your daily fire emissions. If they are in GMT, you need to update COSTCY file for all country to be in GMT to avoid any time zone shift during the run.

Thanks Mr Baek.
In fact, that´s the problem I have right now.
I simulated daily inventory netCDF files, putting a factor of 1 for monthly and weekly profiles. I obtained results, but there are some weird, because it suposes to be biomass burning emissions, and I can see emissions from Ocean. So, the grid cells with emissions are not well located geograpically. That problem i did not observed using edgar inventory.
I attached the image I obtained in Verdi, and you can see my problem.

I also attached you the global maps for biomass burning I used to (the same as Edgar in resolution 3600 x 1800)

Do you know what could be the cause of it?

Thanks for your time

Hello,
I have been making some calculations with the new EDGAR database for several domains in Europe with annual inventories and it works properfly. However, I found that “temporal” gives me an error: “Problem with input data” when modifying the month in the ARINV list input file. Do I have to modify any format of the inventory netcdf input files? or should I modify any additional environment variables?

Thank you for your help.

Hi Eduardo,
Are you still having a problem on processing Temporal? What kind of error message from Temporal?

The proper and normal way to convert CSV to I/O API is to use the M3TOOLS program “m3fake” –
see https://cjcoats.github.io/ioapi/M3FAKE.html or https://www.cmascenter.org/ioapi/documentation/all_versions/html/M3FAKE.html.

Note that the I/O API is in fact an “applications programming interface” (see https://en.wikipedia.org/wiki/Application_programming_interface), not a data format, and that attempts to treat it as one are NOT SUPPORTED.

Carlie J. Coats, Jr., Ph.D. I/O API Author/Maintainer

Hello Baek,
The message I got was: "ERROR: Missing or negative emission value(s) in inventory for “mycompounds” and at the end “***ERROR ABORT in subroutine TEMPORAL Problem with input data.”
Anyway, I solved the issue by using monthly files and modifying monthly temporal profiles in “atpro_edgar_monthly.txt” file so they all have same values for all months.

2 Likes

If you are using the monthly inventory, yes you can use the same monthly values for all months. Good to hear you were able to resolve the issue.

BH