<jupyter_start><jupyter_text>Generating a set of observation points Notebook to open a dictionary with the properties of a set observation points and a topography for using in some test for Equivalent layer with positivity.   Import libraries<jupyter_code>%matplotlib inline
from IPython.display import Markdown as md
from IPython.display import display as dp
import string as st
import sys
import numpy as np
import matplotlib.pyplot as plt
import cPickle as pickle
import datetime

from fatiando.utils import gaussian2d
from fatiando.gridder import regular
notebook_name = 'generating_grid.ipynb'<jupyter_output><empty_output><jupyter_text>Importing auxiliary functions<jupyter_code>dir_modules = '../../../mypackage'
sys.path.append(dir_modules)
import auxiliary_functions as func<jupyter_output><empty_output><jupyter_text>List of saved files<jupyter_code>saved_files = []<jupyter_output><empty_output><jupyter_text>2D grid of points  Regular grid<jupyter_code>regular_grid = dict()
regular_grid['area'] = [-6500.,5500.,-5500.,6500.]
regular_grid['Nx'],regular_grid['Ny'] = 25, 25
regular_grid['shape'] = (regular_grid['Nx'],regular_grid['Ny'])
regular_grid['z_obs'] = 0.
regular_grid['N'] = regular_grid['Nx']*regular_grid['Ny'] 
regular_grid['x'],regular_grid['y'],regular_grid['z'] = regular(regular_grid['area'],regular_grid['shape'],regular_grid['z_obs'])<jupyter_output><empty_output><jupyter_text>Regular grid spacing<jupyter_code>regular_grid['dx'] = (regular_grid['area'][1] - regular_grid['area'][0])/(regular_grid['Nx']-1.)

print 'dx = %.1f m' % regular_grid['dx']
regular_grid['dy'] = (regular_grid['area'][3] - regular_grid['area'][2])/(regular_grid['Ny']-1)

print 'dy = %.1f m' % regular_grid['dy']<jupyter_output>dy = 500.0 m<jupyter_text>Regular grid visualization<jupyter_code>title_font = 20
bottom_font = 18
saturation_factor = 1.
plt.close('all')
plt.figure(figsize=(9,9), tight_layout=True)

plt.title('Regular grid (%.0f,%.0f) ' % (regular_grid['Nx'],regular_grid['Ny']), fontsize=title_font)
plt.plot(regular_grid['y'], regular_grid['x'],'k.')
plt.xlabel('y (m)', fontsize = title_font)
plt.ylabel('x (m)', fontsize = title_font)
plt.ylim(np.min(regular_grid['x']),np.max(regular_grid['x']))
plt.xlim(np.min(regular_grid['y']),np.max(regular_grid['y']))
plt.tick_params(labelsize=15)

file_name = 'figs/regular/grid_regular'
plt.savefig(file_name+'.png',dpi=300)
saved_files.append(file_name+'.png')

plt.savefig(file_name+'.eps',dpi=300)
saved_files.append(file_name+'.eps')


plt.show()<jupyter_output>/home/vanderlei/anaconda3/envs/fatiando2/lib/python2.7/site-packages/matplotlib/figure.py:2299: UserWarning: This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.
  warnings.warn("This figure includes Axes that are not compatible "<jupyter_text>Generating .pickle file<jupyter_code>now = datetime.datetime.utcnow().strftime('%d %B %Y %H:%M:%S UTC')
regular_grid['metadata'] = 'Generated by {name} on {date}'.format(date=now, name=notebook_name)
file_name = 'data/regular_grid.pickle'
with open(file_name, 'w') as f:
    pickle.dump(regular_grid, f)
    
saved_files.append(file_name)<jupyter_output><empty_output><jupyter_text>Airborne survey<jupyter_code>airborne_survey = dict()
airborne_survey['area'] = [-6500.,5500.,-5500.,6500.]
airborne_survey['Nx'],airborne_survey['Ny'] = 49, 25
airborne_survey['shape'] = (airborne_survey['Nx'],airborne_survey['Ny'])
airborne_survey['z_obs'] = -100.
airborne_survey['N'] = airborne_survey['Nx']*airborne_survey['Ny'] 
airborne_survey['x'],airborne_survey['y'],airborne_survey['z'] = regular(airborne_survey['area'],airborne_survey['shape'],airborne_survey['z_obs'])<jupyter_output><empty_output><jupyter_text>Airborne survey spacing<jupyter_code>airborne_survey['dx'] = (airborne_survey['area'][1] - airborne_survey['area'][0])/(airborne_survey['Nx']-1.)
airborne_survey['dy'] = (airborne_survey['area'][3] - airborne_survey['area'][2])/(airborne_survey['Ny']-1)

print 'dx = %.1f m' % airborne_survey['dx']
print 'dx = %.1f m' % airborne_survey['dx']
print 'dy = %.1f m' % airborne_survey['dy']
print 'Number of data : %.1f ' % airborne_survey['N']<jupyter_output>dx = 250.0 m
dy = 500.0 m
Number of data : 1225.0<jupyter_text>Airborne survey visualization<jupyter_code>title_font = 20
bottom_font = 18
saturation_factor = 1.
plt.close('all')
plt.figure(figsize=(9,9), tight_layout=True)

plt.title('Airborne lines(%.0f,%.0f) ' % (airborne_survey['Nx'],airborne_survey['Ny']), fontsize=title_font)
plt.plot(airborne_survey['y'], airborne_survey['x'],'k.')
plt.xlabel('y (m)', fontsize = title_font)
plt.ylabel('x (m)', fontsize = title_font)
plt.ylim(np.min(airborne_survey['x']),np.max(airborne_survey['x']))
plt.xlim(np.min(airborne_survey['y']),np.max(airborne_survey['y']))
plt.tick_params(labelsize=15)

file_name = 'figs/airborne/airborne_lines'
plt.savefig(file_name+'.png',dpi=300)
saved_files.append(file_name+'.png')

plt.savefig(file_name+'.eps',dpi=300)
saved_files.append(file_name+'.eps')


plt.show()<jupyter_output><empty_output><jupyter_text>Generating .pickle file<jupyter_code>now = datetime.datetime.utcnow().strftime('%d %B %Y %H:%M:%S UTC')
airborne_survey['metadata'] = 'Generated by {name} on {date}'.format(date=now, name=notebook_name)
file_name = 'data/airborne_survey.pickle'
with open(file_name, 'w') as f:
    pickle.dump(airborne_survey, f)
    
saved_files.append(file_name)<jupyter_output><empty_output><jupyter_text>Saved files<jupyter_code>with open('reports/report_%s.md' % notebook_name[:st.index(notebook_name, '.')], 'w') as q:
    q.write('# Saved files \n')
    now = datetime.datetime.utcnow().strftime('%d %B %Y %H:%M:%S UTC')
    header = 'Generated by {name} on {date}'.format(date=now, name=notebook_name)
    q.write('\n\n'+header+'\n\n')
    for i, sf in enumerate(saved_files):
        print '%d  %s' % (i+1,sf)
        q.write('*  `%s` \n' % (sf))<jupyter_output>1  figs/regular/grid_regular.png
2  figs/regular/grid_regular.eps
3  data/regular_grid.pickle
4  figs/airborne/airborne_lines.png
5  figs/airborne/airborne_lines.eps
6  data/airborne_survey.pickle
{'fraction_non_alphanumeric': 0.17250937550953857, 'fraction_numerical': 0.0211968041741399, 'mean_word_length': 7.750356633380885, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 45, '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': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '197132', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 2450, 'n_tokens_neox': 2345, 'n_words': 369, 'path': 'code/notebooks/synthetic_tests/model_multibody_shallow-seated/.ipynb_checkpoints/generating_grid-checkpoint.ipynb', 'repo_name': 'pinga-lab/eqlayer-magnetization-direction', 'size': '6133'}