I’m trying to read O3 concentration from another CMAQ outputfile instead of from the last time step of the running file, which has the same gird and time settings. Anyone can give me some advices on how to do this?
Thank you for your reply, but overwriting CGRID file can only replace the first hour, I want to read each hour from another file, so I need to overwrite the O3 data in my CONC file after each hour’s calculation.
I thought you meant that you wanted to start a CMAQ simulation with a different initial condition. If instead you mean that you want to create an output file that has some variables from one output file and some other variables from a different output file, then that is what the COMBINE program (linked above) allows you to do.
Or (more flexibly, because it allows more-general linear combinations, including the “trivial” extract-a-variable ones), I/O API m3tools program m3combo: https://cjcoats.github.io/ioapi/M3COMBO.html
I don’t know why you would want to do that. At any rate, CMAQ is not set up to handle such an artificial case of continually replacing a value that is being calculated. While it should not be too difficult to modify the code to do what you describe, doing so is not something that is supported.
The answer you obtain would of course depend on when (during or before which science process) you decided to replace the model’s current calculated value for ozone with the value from the previous simulation.
you can you python to extract the information you need using netcdf library
first you need to import netcdf library and numpy
from netCDF4 import Dataset import numpy as np
open the CMAQ file using the netcdf Dataset
aconc = Dataset(path/to/your/file/CONC.nc, mode='r')
#after you just need to extract the O3 from your file.
Usually the CMAQ output netcdf file has this configuration:
(TSTEP, LAY, ROW, COL)
So you just need to select the layer, row and col you want to get the dat, like this:
O3 = aconc.variables['O3'][:,0,30,30]
[:,0,30,30] --> this part of the code means:
: means all time steps
0 means the first layer
30 and 30 are the respective row and column.
Yes, i know i need to modify the original CMAQ code, but i have no idea which codes and how should i modify. Could you give me some tips?
Thank you Rizzieri. This method is very helpful for post-processing, but want to replace the value each hour during the CMAQ calculation process.