I am trying to plot a full swath orbit of ASCAT ocean wind vectors and its wvc quality flags using the pyresample module. A link to ASCAT the netcdf files can be found here: ftp://podaac-ftp.jpl.nasa.gov/allData/ascat/preview/L2/metop_a/12km/ From the documentation I have read on the module, it does not describe very well on how we can find the information within the file to satisfy the geometry area definition. An example code is here below on plotting a swath of satellite data
from netCDF4 import Dataset
import numpy as np
from pyresample import image, geometry
import pyresample as pr
I extract the lons, lats, & wvc_quality_flag from the netcdf file
area_id = 'ease_sh'
name = 'Antarctic EASE grid'
proj_id = 'ease_sh'
proj4_args = 'proj=laea, lat_0=-90, lon_0=0, a=6371228.0, units=m'
x_size = 425
y_size = 425
area_extent = (-5326849.0625,-5326849.0625,5326849.0625,5326849.0625)
proj_dict = {'a': '6371228.0', 'units': 'm', 'lon_0': '0',
'proj': 'laea', 'lat_0': '-90'}
area_def = geometry.AreaDefinition(area_id, name, proj_id, proj_dict, x_size,y_size, area_extent)
swath_def = geometry.SwathDefinition(lons=lon, lats=lat)
result = pr.kd_tree.resample_nearest(swath_def, wvc_quality_flag, area_def, radius_of_influence=20000, fill_value=None)
pr.plot.save_quicklook('/tmp/tb37v_pc.png', area_def, result, num_meridians=0, num_parallels=0, label='Flags')
AttributeError: 'module' object has no attribute 'plot'
First, I get an error that the pyresample module does not have that attribute plot when the documentation says that it does and the "area_def" is never defined anywhere in the ASCAT netcdf file. Is pyresample just not plausible for these type of files or am I not looking in the proper place for those definitions within the metadata of the ASCAT file? Some clarification on this module would really help! Thanks again!
There are actually two questions here. First one, the
plot
submodule.plot
is a submodule, and it can be imported here together with the other submodules:Second, the target area definition is defined on the fly in this block:
The source swath definition is defined as:
And I assume the
lon
andlat
arrays have been acquired prior to resampling.PS. Yes, pyresample is meant for exactly these kind of tasks. You don't need any extra meta data from the files with the swath data, longitudes and latitudes array are sufficient.