Hello,
I have a set of NetCDF files that are in Lambert Conformal projection,
and I want to convert them to rectilinear, lat/lon projection. I'm
able to do this and plot the data and print the data out to a png
file. However, I want to get access to the underlying data as it
appears after the projection. I want to take this data and write it
out to another file using an in-house file format.
I've been trying to probe the objects that are involved in creating
the images using 'dir' to see if there is a way that I can get access
to the underlying data, but I've come up short so far.
Here is a skeleton of the code that I'm working with:
# create Basemap using this info
map = Basemap(projection='merc',
lat_0 = map_center_lat, lon_0 = -map_center_lon,
llcrnrlat = min_lat, urcrnrlat = max_lat,
llcrnrlon = min_lon, urcrnrlon = max_lon,
rsphere = 6371200.0, resolution = 'f',
area_thresh = 10000)
# this part is what takes the most amount of time
# x, y = map(lons.data, lats.data) # compute map projection coordinates.
x, y = map(lons[0], lats[0])
# the first slot in the shape array denotes the number of hours
num_hours = data.shape[0]
# frame counter for the output filenames
frame_num = 0
# step through all of the hours
for hr in range (num_hours):
# get all of the data (2D data) for the current hr
data_hr = data[hr, :, :]
# create a figure
fig = plt.figure(figsize=(10,8))
plt.subplot(111)
ax = plt.gca()
dlon = 1.0
for xlabel_i in ax.get_xticklabels():
xlabel_i.set_fontsize(4)
for ylabel_i in ax.get_yticklabels():
ylabel_i.set_fontsize(4)
draw_map (map, ax, dlon)
v = <compute_contour_levels>
p = map.contourf (x, y, data_hr, v)
Any suggestions? Thanks!