<jupyter_start><jupyter_text>Grid Generation BasicsThis section will cover:  1. Loading and visualizing boundary data  2. Generating visualizing a basic grid  3. Adding focus to the grid  This is sorely lacking in detail and explanation.For more help on this matter, see the [pygridgen documentation](http://pygridgen.github.io/pygridgen/tutorial/basics.html).<jupyter_code>%matplotlib inline
import warnings
warnings.simplefilter('ignore')

import numpy as np
import matplotlib.pyplot as plt
import pandas

import pygridgen as pgg
import pygridtools as pgt

import seaborn
clear_bkgd = {'axes.facecolor':'none', 'figure.facecolor':'none'}
palette = seaborn.color_palette(palette='deep')
seaborn.set(style='ticks', context='notebook', rc=clear_bkgd)<jupyter_output><empty_output><jupyter_text>Loading and plotting the boundary data<jupyter_code>csvfile = "basic_data/boundary.csv"
!cat {csvfile}
boundary = pandas.read_csv(csvfile)
boundary['reach'] = 'My Reach'
fig, ax = plt.subplots(figsize=(5, 5), subplot_kw={'aspect':'equal'})
fig = pgt.viz.plot_domain(data=boundary, domain_x='x', domain_y='y', beta='beta', ax=ax)

seaborn.despine(ax=ax)<jupyter_output><empty_output><jupyter_text>Generating a grid with `pygridgen`, plotting with `pygridtools`<jupyter_code>grid = pgg.Gridgen(boundary.x, boundary.y, boundary.beta, shape=(50,50), ul_idx=2)

fig, ax = plt.subplots(figsize=(10, 10), subplot_kw={'aspect':'equal'})
fig = pgt.viz.plot_cells(grid.x, grid.y, ax=ax)
fig = pgt.viz.plot_domain(data=boundary, domain_x='x', domain_y='y', beta=None, ax=ax)
ax.set_xlim([0, 25])
ax.set_ylim([0, 25])
seaborn.despine(ax=ax)<jupyter_output><empty_output><jupyter_text>Using *focus* to refine and coarsen portions of the grid<jupyter_code>focus = pgg.Focus()

focus.add_focus(0.90, 'y', factor=0.5, extent=0.05)
focus.add_focus(0.50, 'y', factor=5, extent=0.1)
focus.add_focus(0.65, 'x', factor=4, extent=0.2)
grid.focus = focus
grid.generate_grid()

fig, ax = plt.subplots(figsize=(10, 10), subplot_kw={'aspect':'equal'})
fig = pgt.viz.plot_cells(grid.x, grid.y, ax=ax)
fig = pgt.viz.plot_domain(data=boundary, domain_x='x', domain_y='y', beta=None, ax=ax)

ax.set_xlim([0, 25])
ax.set_ylim([0, 25])
seaborn.despine(ax=ax)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15562472209871053, 'fraction_numerical': 0.022232103156958647, 'mean_word_length': 7.458646616541353, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '521870', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 914, 'n_tokens_neox': 867, 'n_words': 175, 'path': 'docs/tutorial/01_GridgenBasics.ipynb', 'repo_name': 'pygridgen/pygridtools', 'size': '2249'}