Closed gc13141112 closed 5 years ago
Instead of posting the code segment that you did not use, please post the segment from mappings.json (precisely) that you did use.
There are the original mappings.json(mappings.log) and the changed mappings.json (mappings_change.log). Since there is no such variable (PSURF), I added PSURF=np.ones_like(O3[:,0][:, None])*1013.25 in mappings_change.log, as follows: mappings.log mappings_change.log
The problem is the subscripting of a float (1013.25).
Assuming your input data is 4D (t, z, y, x), which is normal. Replace your definition shown below:
(hyam[:].reshape(1, -1).T + hybm[:].reshape(1, -1).T * np.ones_like(O3[:,0][:, None])*1013.25[:][:, [0]].T).T * 100.
With this definition:
(hyam[:].reshape(1, -1, 1, 1) + hybm[:].reshape(1, -1, 1, 1) * np.ones_like(O3[:,[0]])*1013.25) * 100.
Thank you for your help! I can process pncglobal2cmaq.py.
I use PRESS= np.ones_like(O3[:,0][:, None])*1013.25 to replace the press, and I have an error when I process pncglobal2cmaq.py, as follows:
NO2, Traceback (most recent call last): File "/public/LIBRARY/python36/bin/pncglobal2cmaq.py", line 4, in
import('pkg_resources').run_script('PseudoNetCDF==3.0.1', 'pncglobal2cmaq.py')
File "/public/LIBRARY/python36/lib/python3.6/site-packages/pkg_resources/init.py", line 743, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/public/LIBRARY/python36/lib/python3.6/site-packages/pkg_resources/init.py", line 1498, in run_script
exec(code, namespace, namespace)
File "/public/LIBRARY/python36/lib/python3.6/site-packages/PseudoNetCDF-3.0.1-py3.6.egg/EGG-INFO/scripts/pncglobal2cmaq.py", line 1487, in
makeibcon(args)
File "/public/LIBRARY/python36/lib/python3.6/site-packages/PseudoNetCDF-3.0.1-py3.6.egg/EGG-INFO/scripts/pncglobal2cmaq.py", line 1226, in makeibcon
rpressv = eval(mappings_file['PRESS']['expression'], None, nd49.variables)
File "", line 1, in
TypeError: 'float' object is not subscriptable