Python embedding using several MET tools: implementation unclear from docs #1605
-
I am attempting to utilize either regrid_data_plane or shift_data_plane to convert my data to a netcdf format so that I can use the gen_vx_mask tool to divide the data I'm investigating into smaller segments so that I can use the mode tool on these smaller regions. I was unable to use python embedding to use the gen_vx_mask tool outright, so this is a workaround for that issue. Below is a template for using shift_data_plane to create a .nc file from a .grib file
I tried to use python embedding to accomplish this:
No errors are returned, the command simply doesn't run and the following text is displayed:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
@Wesley-J-Davis reading through this section of Appendix F of the MET User's Guide, I think you're very close. That section lists two calls to plot_data_plane that are equivalent, one using the PYTHON_NUMPY keyword and one using MET_PYTHON_INPUT_ARG.
I see that you're doing the latter, but the one important detail you're missing is setting In general when a MET tool returns bad status and prints the usage statement, that means there was some problem in parsing the required arguments. It's printing the usage statement to tell you to look closely at the args. But I'm not totally sure why that's happening in this case. I don't fully understand why you're running shift_data_plane... but once we get past this issue, we could discuss that some more. |
Beta Was this translation helpful? Give feedback.
-
I'm running shift_data_plane simply to convert the python files to .nc files. I'm shifting zero degrees to just get the .nc file to work with so I can run gen_vx_mask without all the PYTHON_NUMPY troubleshooting The old command:
The error
It was treating the path to the actual file as the path to the reader. So, I change up the command and the structure of the reader to match it
The error:
Now, I expect this sys.argv[1] to be: coamps_sfc_ci-mask-cth-co_utc12_tau0_predictor_2018010112-2019123112:2019123112, because that's what prints out when I run the reader using the command:
So what I see happening here is that the fcst_file argument in shift_data_plane is being treated as if it's supposed to be a python script. So it feels like I should be putting the path to the reader in this place. But then when I do, and the program is called, the sys.argv[] logic no longer works because the actual command being run by the MET internals is:
Therefore, the arguments that I'm intending to pass in to the script are being truncated. Stands to reason that perhaps I should pass the python reader arguments in the fcst_file argument of shift_data_plane. The command:
The error:
Once again, treating the fcst_file argument as if it's supposed to be the file reader
Next, I abandon the MET_PYTHON_INPUT_ARG method for the PYTHON_NUMPY method The command:
The error:
|
Beta Was this translation helpful? Give feedback.
-
This command ran successfully. I had to eliminate any arguments that would usually be passed into the python reader and just hard code it all in there. |
Beta Was this translation helpful? Give feedback.
This command ran successfully. I had to eliminate any arguments that would usually be passed into the python reader and just hard code it all in there.