Sorry if this is already documented, but how to I save to a netCDF in a script.
So, similar to the file / save / to netCDF
Thanks,
TJS
Saving to a netCDF in a script
Re: Saving to a netCDF in a script
Hi TJS -
You can export a netCDF file using the Export > Export Grid/Image to netCDF formula. You can find this formula in the Field Selector, once you select Formulas under Data Sources on the left side of the tab. If you mouse over this formula, you will see that the actual function name for this formula is exportGridToNetcdf. This is the function name you would use in your script.
For example, here is a script that loads in data from a remote grid and exports the earliest time of MSLP as a NetCDF file:
As an alternative to finding out the function names by mousing over the formula in the Field Selector, you can look in the Jython Library (Tools>Formulas>Jython Library) where you can look under the System tree. Or you can look at the Jython Library page in the User's Guide.
Please let me know if you have any questions.
Thanks -
Bob Carp
You can export a netCDF file using the Export > Export Grid/Image to netCDF formula. You can find this formula in the Field Selector, once you select Formulas under Data Sources on the left side of the tab. If you mouse over this formula, you will see that the actual function name for this formula is exportGridToNetcdf. This is the function name you would use in your script.
For example, here is a script that loads in data from a remote grid and exports the earliest time of MSLP as a NetCDF file:
Code: Select all
gridParms = dict(
filename = 'http://weather.rsmas.miami.edu/thredds/dodsC/grib/NCEP/GFS/CONUS_80km/GFS_CONUS_80km_20150821_0600.grib1/GC',
field = 'Pressure_reduced_to_MSL_msl',
)
mslpField = loadGrid(**gridParms)
exportGridToNetcdf(mslpField,'C:/Users/myuser/netcdfTest2.nc')
As an alternative to finding out the function names by mousing over the formula in the Field Selector, you can look in the Jython Library (Tools>Formulas>Jython Library) where you can look under the System tree. Or you can look at the Jython Library page in the User's Guide.
Please let me know if you have any questions.
Thanks -
Bob Carp