thanks, Christian and Nash.
I can confirm that the issue was resolved when I forced TFLAG to an array of zeros. I think the issue in shp2cmaq is coming from cmaqsatproc which forces the date to 1970 (screesnshot below), and thus the mask is not seen to be time-independent by ISAM.
For now, I’m using a patched version of the shp2cmaq code which seems to work by making the following two changes:
(1) pass an extra argument to specify that a timeindependent file is wanted
def shp2cmaq(
shppath, attrkey, gdnam, gdpath=None, outpath=None, bcrs='EPSG:4269',
srckey='intersection_area', outformat='NETCDF4_CLASSIC', prefix=None,
overwrite=False, time_independent=True, verbose=1
):
and then
(2) add the following snippet at the end of the method
igf.to_netcdf(outpath, format=outformat)
# add the following
if time_independent:
from netCDF4 import Dataset
import numpy as np
with Dataset(outpath, "r+") as ds:
tflag_len = ds.variables['TFLAG'][0,:].shape[0]
ds.variables['TFLAG'][0,:] = np.array([0,0]*tflag_len).reshape(tflag_len,2)
return outpath
