You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Will read netcdf files produced at APL into dictionary to use with pyDARN.
Code to work from:
"""Demo read SuperDARN netCDF files available from https://superdarn.jhuapl.edu/download/nc_utils available from github.com/alexchartier/nc_utilsAlex Chartier, 2023"""try:
importnc_utilsexcept:
print('Get nc_utils from github.com/alexchartier/nc_utils')
importsysdefmain(fit_fn, grid_fn):
# Read the whole file using load_nc() (provides access to header info)grid_file=nc_utils.load_nc(grid_fn)
fit_file=nc_utils.load_nc(fit_fn)
# Read the variables (a little easier to use)grid_vars=nc_utils.ncread_vars(grid_fn)
fit_vars=nc_utils.ncread_vars(fit_fn)
""" Print the details of the fit file """print('\n*****')
print(fit_fn)
print(fit_file.description) # Note the grid_file (and other python objects) can be interrogated on the commandline using dir()print('Lat: %s'%fit_file.lat)
print('Lon: %s'%fit_file.lon)
print('Boresight: %s\n'%fit_file.boresight)
fork, vinfit_vars.items():
print('%s: %i entries, e.g. %1.1f'% (k, len(v), v[0]) )
print('*****\n')
""" Print the details of the grid file """print('\n*****')
print(grid_fn)
print(grid_file.description) # Note the grid_file (and other python objects) can be interrogated on the commandline using dir()print('Lat: %s'%grid_file.lat)
print('Lon: %s'%grid_file.lon)
print('Boresight: %s\n'%grid_file.boresight)
fork, vingrid_vars.items():
print('%s: %i entries, e.g. %1.1f'% (k, len(v), v[0]) )
print('*****\n')
if__name__=='__main__':
args=sys.argvdemo_fit_fn="~/Downloads/19940701.gbr.v3.0.despeckled.nc"demo_grid_fn="~/Downloads/20150317.cly.v3.0.grid.nc"assertlen(args) ==3, 'Should have 2 args, e.g.:\n python3 read_nc.py %s %s'% (demo_fit_fn, demo_grid_fn)
fit_fn=sys.argv[1]
grid_fn=sys.argv[2]
main(fit_fn, grid_fn)
The text was updated successfully, but these errors were encountered:
New Feature
Name: read_netcdf
module: in superdarn.py
package: superdarn
Scope
Will read netcdf files produced at APL into dictionary to use with pyDARN.
Code to work from:
The text was updated successfully, but these errors were encountered: