grid_show
To do:
To visulize grid data, e.g. raster objec(s)
- IO.grid_show.hillshade(raster_obj, figsize=None, azdeg=315, altdeg=45, vert_exag=1, cmap=None, blend_mode='overlay', alpha=1, scale_ratio=1)
Draw a hillshade map
- IO.grid_show.make_gif(output_file, obj_list=None, header=None, array_3d=None, time_str=None, breaks=None, fig_names=None, duration=0.5, delete=False, **kwargs)
Create animation of gridded data
- Parameters
mask_header – (dict) header file provide georeference of rainfall mask
start_date – a datetime object to give the initial date and time of rain
duration – duration for each frame (seconds)
cellsize – sclar (meter) the size of rainfall grid cells
- IO.grid_show.make_mp4(output_file, obj_list=None, header=None, array_3d=None, time_str=None, breaks=None, fig_names=None, delete=False, fps=10, **kwargs)
Create a video file based on a series of grids
- Parameters
obj_list – a list of Raster objects
header – a header dict providing georeference the grid [not necessary if obj_list was given]
array_3d – a 3D numpy array storing grid values for each timestep (in 1st dimension), [not necessary if obj_list was given]
time_str – a list of string to show time information for each frame
- IO.grid_show.mapshow(raster_obj=None, array=None, header=None, ax=None, figname=None, figsize=None, dpi=300, title=None, cax=True, cax_str=None, scale_ratio=1, **kwargs)
Display raster data without projection
- Parameters
raster_obj – a Raster object
array – to make Raster object if raster_obj is not given
header – to make Raster object if raster_obj is not given
figname – the file name to export map, if figname is empty, then the figure will not be saved
figsize – the size of map
dpi – The resolution in dots per inch
covers (vmin and vmax define the data range that the colormap) –
**kwargs – keywords argument of function imshow
- IO.grid_show.plot_shape_file(shp_file, figsize=None, ax=None, color='r', linewidth=0.5, **kw)
plot a shape file to a map axis
- IO.grid_show.rankshow(raster_obj=None, array=None, header=None, figname=None, figsize=None, dpi=200, ax=None, color='Blues', breaks=[0.2, 0.3, 0.5, 1, 2], legend_kw=None, scale_ratio=1, alpha=1, **kwargs)
Display water depth map in ranks defined by breaks
- Parameters
breaks – list of values to define rank. Array values lower than the first break value are set as nodata.
color – color series of the ranks
ylabelrotation – scalar giving degree to rotate yticklabel
legend_kw – dict, keyword arguments to set legend. A colobar rather than a legend be displayed if legend_kw is None.
**kwargs – keywords argument of function imshow
Example
- rankshow(figname=None, figsize=None,
dpi=200, ax=None, color=’Blues’, breaks=[0.2, 0.3, 0.5, 1, 2], legend_kw={‘loc’:’upper left’, ‘facecolor’:None,
‘fontsize’:’small’, ‘title’:’depth(m)’, ‘labelspacing’:0.1},
scale_ratio=1, alpha=1)
- IO.grid_show.vectorshow(obj_x, obj_y, figname=None, figsize=None, dpi=300, ax=None, scale_ratio=1, **kwargs)
plot velocity map of U and V, whose values stored in two raster objects seperately