Validate BlockModel

This example demonstrates how to validate a block model prior to writing it to an OMF file.

import logging
import shutil
import tempfile
import webbrowser
from pathlib import Path

import pandas as pd

from omfpandas import OMFDataConverter, OMFPandasReader, OMFPandasWriter

Instantiate

Create the object OMFPandas with the path to the OMF file.

logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s %(levelname)s %(module)s - %(funcName)s: %(message)s',
                    datefmt='%Y-%m-%dT%H:%M:%S%z')
test_omf_path: Path = Path('./../assets/v2/test_file.omf')

# create a temporary copy to preserve the original file
temp_omf_path: Path = Path(tempfile.gettempdir()) / 'test_file_copy.omf'
shutil.copy(test_omf_path, temp_omf_path)

# Display the head of the original block model
blocks: pd.DataFrame = OMFPandasReader(filepath=temp_omf_path).read_blockmodel(blockmodel_name='vol')
blocks.head()
random attr
x y z dx dy dz
10.5 10.5 -9.5 1.0 1.0 1.0 0.727986
11.5 10.5 -9.5 1.0 1.0 1.0 0.277389
12.5 10.5 -9.5 1.0 1.0 1.0 0.351741
13.5 10.5 -9.5 1.0 1.0 1.0 0.999272
14.5 10.5 -9.5 1.0 1.0 1.0 0.495092


Write with Schema

The schema used to validate the dataframe is a Pandera schema. The schema is a YAML file that is loaded into the Pandera library. The schema is used to validate the dataframe before writing it to the OMF file.

omfpw: OMFPandasWriter = OMFPandasWriter(filepath=temp_omf_path)
omfpw.write_blockmodel(blocks=blocks, blockmodel_name='vol',
                       pd_schema_filepath=test_omf_path.with_suffix('.schema.yaml'),
                       allow_overwrite=True)

The schema is persisted inside the omf file. This enables the schema to be used to validate modifications.

bm = omfpw.get_element_by_name('vol')
print(bm.metadata.get('pd_schema'))
{"schema_type": "dataframe", "version": "0.20.3", "columns": {"random attr": {"title": "Random Attribute", "description": "A random attribute for testing", "dtype": "float64", "nullable": false, "checks": {"greater_than_or_equal_to": 0.0, "less_than_or_equal_to": 1.0}, "unique": false, "coerce": false, "required": true, "regex": false}}, "checks": null, "index": null, "dtype": null, "coerce": true, "strict": false, "name": null, "ordered": false, "unique": null, "report_duplicates": "all", "unique_column_names": false, "add_missing_columns": false, "title": "Test Schema", "description": "A test dataset schema."}

Demonstrate Failure

We’ll demonstrate a failure by modifying the block model in a way that violates the schema.

blocks['random attr'] = blocks['random attr'] * 2

try:
    omfpw.write_blockmodel(blocks=blocks, blockmodel_name='vol',
                           pd_schema_filepath=test_omf_path.with_suffix('.schema.yaml'),
                           allow_overwrite=True)
except Exception as e:
    print(e)
Column 'random attr' failed element-wise validator number 1: less_than_or_equal_to(1.0) failure cases: 1.4559720737457786, 1.9985444352433313, 1.5907896431626796, 1.8440280921144294, 1.029931558509397, 1.3151572983059887, 1.0590145853319994, 1.2071569408544958, 1.4762044042932776, 1.659734334331123, 1.5458775431601834, 1.5284277086895106, 1.429773073123145, 1.36691049180721, 1.8428843020771741, 1.7181286907304707, 1.7232965755778566, 1.2805422743154005, 1.8140380167622396, 1.0495087164113834, 1.697546460456173, 1.830127740647213, 1.426383448407208, 1.8715684118119214, 1.811018412078782, 1.5636218408160385, 1.670402823040675, 1.639066773513726, 1.2413873316005761, 1.088998056678794, 1.4417580551698117, 1.1992796211513195, 1.122879179466444, 1.0527540583183441, 1.6364404326145545, 1.3339029696035074, 1.9027847554811121, 1.5358564377066184, 1.2234817990647127, 1.6785281981864928, 1.5953763016815006, 1.7585570130681376, 1.5778669273408064, 1.945116455601474, 1.5948025441299234, 1.084882601026607, 1.9285261691677713, 1.3286708968638379, 1.9203100656063952, 1.4481050763680714, 1.4559882787703629, 1.2788712023452786, 1.8414418188570525, 1.674037289230991, 1.9787453579495589, 1.573904820043195, 1.5488979974059058, 1.7347640352000473, 1.9801781702690502, 1.5996996115148243, 1.875600238390073, 1.759041032645268, 1.0354764532387968, 1.140493709013436, 1.9565302015250021, 1.5612056474853147, 1.7741966508262832, 1.7867063643339902, 1.8629264044745195, 1.5761962237564733, 1.872302219157308, 1.2398770171936138, 1.8409737120140761, 1.443072384620432, 1.6587397715928294, 1.9582642188436352, 1.181570067887426, 1.2453137087797088, 1.314650903468758, 1.5898949749767037, 1.9498279253587643, 1.1633491804986067, 1.052220189762828, 1.409851863480869, 1.3191513707074518, 1.7736932104662082, 1.6283965601061623, 1.0629028560878173, 1.414626173550225, 1.9109115732228077, 1.5591159202708422, 1.9984381929831578, 1.799255916420796, 1.1189582684938597, 1.1599958422540977, 1.6461628074376278, 1.5229612714328409, 1.7796693213010435, 1.8785677231276448, 1.0125987366874842, 1.9111070175145743, 1.7700789129954848, 1.1865726531525471, 1.216195559512752, 1.38014398790614, 1.057648583752983, 1.0698373368272833, 1.2693170305848045, 1.2768293084400142, 1.1350289185034124, 1.8531618778220411, 1.066087560379272, 1.6287423839422865, 1.528678094703761, 1.3983106563855332, 1.243383212412444, 1.3380331271169879, 1.6527423832272432, 1.8985877559661397, 1.39437037288958, 1.3893738005461227, 1.0537344101778414, 1.3686438846415347, 1.4943821095450087, 1.7289470937828468, 1.149957523512327, 1.5182072973288705, 1.8181824164021771, 1.840439706825174, 1.861255766766524, 1.444250303368639, 1.8537229150038916, 1.7956090619372664, 1.2694348460644236, 1.5284048672921213, 1.0962195476195329, 1.5406484076244111, 1.009960761064082, 1.7479579586606233, 1.1079310843605394, 1.55925121601683, 1.9126014762596342, 1.195277660466373, 1.0537920997051509, 1.9644941137338583, 1.541299562221625, 1.832607568750927, 1.448718089874294, 1.442423843387346, 1.1459541676545069, 1.163648142014833, 1.5819512993485774, 1.4099720339690156, 1.7725693122498036, 1.5822298727966697, 1.5093779868307335, 1.458491469080891, 1.6828228851704288, 1.7429194073986, 1.9605035672219853, 1.2900824147027883, 1.8626317256100708, 1.574513512170475, 1.340455516478532, 1.8498554801589713, 1.2473292505294038, 1.6628232386123067, 1.518424603407974, 1.6898923132937074, 1.618801732238258, 1.2329538454182325, 1.5626866986338535, 1.4370432220322156, 1.368551235303031, 1.7907413073878613, 1.1786430669900099, 1.2694954436777777, 1.9382926316496636, 1.1273531969637043, 1.4013539686007728, 1.5754528808547803, 1.7507903684750765, 1.8951435462551516, 1.0286274896763188, 1.9768634447994224, 1.4231386171537097, 1.4734089844326141, 1.518961944932614, 1.482411530695841, 1.3184040815695548, 1.8500423902765537, 1.5758404072111685, 1.260412274746097, 1.9834661258290402, 1.0278926951775516, 1.2598174628270775, 1.9199840729001107, 1.0006739714597923, 1.8830633863437105, 1.3188573378967539, 1.3655674995335703, 1.8333309614873947, 1.9787622145122223, 1.2284694625691508, 1.5189393712673618, 1.0956337680622337, 1.397263424451273, 1.9979675639379926, 1.5305120352614523, 1.8453673244176625, 1.1837850045454192, 1.9283691424519485, 1.3783293491045299, 1.2002962011835385, 1.7221333974725361, 1.8801818861734256, 1.7427057405372657, 1.9430918461596702, 1.2066115206468633, 1.4069525485092917, 1.704325363877499, 1.2840739165120518, 1.956402449871006, 1.256659217426425, 1.1489272204217027, 1.1317715810224838, 1.1253090173349616, 1.1407804671959183, 1.6983444573603474, 1.4619756261089396, 1.7912882180514085, 1.218426440943169, 1.0659576112262805, 1.7850889690124436, 1.6311411174418797, 1.8141586526643165, 1.3948971013227909, 1.0546192927534725, 1.8210077592496, 1.0095445598811064, 1.0366763581587037, 1.4505575076086945, 1.563978071757387, 1.1750291992552868, 1.8020858225543241, 1.6175702304865542, 1.6639578702965374, 1.3739531265916267, 1.9831554052504154, 1.812122311133349, 1.785453195178491, 1.9249207856497246, 1.932023013068842, 1.6786555249130204, 1.498009530545958, 1.0843824865006662, 1.1785887335110674, 1.0698411621215078, 1.7820991775418529, 1.0618407227951665, 1.7139632159667408, 1.3256249281783736, 1.8392132511344217, 1.951000263937331, 1.541250218590793, 1.9548699072750115, 1.4799910710117643, 1.9187836839088643, 1.0944326758812084, 1.4756061903507167, 1.7486677673626303, 1.5267012042463974, 1.4568663279991854, 1.5994317351602685, 1.0344669419889045, 1.3391482568604491, 1.3751080337576602, 1.4456023633936737, 1.2119263597237082, 1.6607269990266247, 1.9794244807841883, 1.912367105761561, 1.981357012243625, 1.3055581123203093, 1.0541407829034584, 1.152621465819579, 1.1126623193971534, 1.1165515878388443, 1.6933560730355965, 1.965505703476005, 1.4774277006018341, 1.0684866376457491, 1.6653515619179329, 1.9291472066387567, 1.4625840639775354, 1.2132855121820498, 1.8453043649018206, 1.0506374369077425, 1.694974140745738, 1.3731377033905257, 1.4017429382810989, 1.184124155948118, 1.3811173997274615, 1.7634650396094422, 1.916330714914486, 1.2774914356555074, 1.4792121444668875, 1.9238357627090743, 1.2672987679365635, 1.20688536064915, 1.0078935130659383, 1.4049600933233837, 1.8713512448387144, 1.1623198929166692, 1.8846858136223612, 1.3815185028692727, 1.2341340908390996, 1.5872709406392334, 1.5320181576772711, 1.9897211169074485, 1.036295740572618, 1.8792065830795228, 1.3071507918251268, 1.0923733078677476, 1.2698620120732764, 1.2395544619634742, 1.1356778865245265, 1.8423501268800424, 1.4330236573685422, 1.1180227153768145, 1.4698364968627162, 1.2466079783770128, 1.1622065956493857, 1.368671235363858, 1.3354137302717646, 1.8345813912170879, 1.8194168068873517, 1.1641118597696603, 1.1583640830560107, 1.916066770107272, 1.282150667887581, 1.2731706521663682, 1.5291896700091836, 1.0616325703339726, 1.5577559392235953, 1.3050085103230884, 1.0694726068629192, 1.836163270348819, 1.472679946424542, 1.7028466592344549, 1.365765501722794, 1.0717301424591104, 1.5979131815882703, 1.7786867201318688, 1.2212860420313423, 1.822035650044459, 1.8688161467432496, 1.0642177428936843, 1.1114304359637448, 1.3590764613513504, 1.3449898009938233, 1.1064603413247402, 1.2866988371954096, 1.8540140458600898, 1.956234819058837, 1.116186775760614, 1.2190214899342382, 1.1205765632119051, 1.2910956884053573, 1.4616407256520936, 1.5349364000907189, 1.2243848735923857, 1.9679153222411776, 1.5974679550090725, 1.0876684858458192, 1.374948195981548, 1.900487026482944, 1.5546214181448337, 1.7718835772900074, 1.9188528550522181, 1.2056993905216198, 1.487359780836916, 1.1827184426161517, 1.9573553252079692, 1.6989813094299173, 1.5429330212012566, 1.5642796508445025, 1.4415970616173897, 1.9084932285253893, 1.0235405202871355, 1.5450855000638062, 1.3391148366379955, 1.3200220256274722, 1.8118748006473286, 1.8685970234181877, 1.2219254069735477, 1.8046481045138383, 1.789361953249785, 1.226376455449333, 1.4346755547214574, 1.7198067504147185, 1.5824331458741792, 1.469250056918037, 1.6498752319901282, 1.8031176752009432, 1.2285209663119798, 1.6811267704641846, 1.074917543361458, 1.6210145829801736, 1.2641951470713022, 1.9139946038650713, 1.785870206849867, 1.2971881844639095, 1.1100692947059387, 1.2619961357717115, 1.6979654699853275, 1.6583567810475943, 1.221612932380173, 1.215392929106768, 1.6095058812135672, 1.396034913688923, 1.287769164826146, 1.1722415886278181, 1.9152776108001903, 1.3801839360663406, 1.3375572394964272, 1.2853186568962087, 1.0740988150122566, 1.2435273519417764, 1.7907765840622785, 1.4196511787102648, 1.3658285734672775, 1.7380433690134978, 1.4681341867270574, 1.221389726267926, 1.3742178768832667, 1.320887715635554, 1.8763340525658414, 1.8449964932458052, 1.5271601588903818, 1.6618685353345934, 1.2213367986562533, 1.662996673308961, 1.9979902112171113, 1.3439442776900241, 1.7730717943189611, 1.9191462979830363, 1.8019897087030645, 1.6726051008967926, 1.0503230115547117, 1.10647369360577, 1.1584311041932964, 1.714448543990711, 1.2633917646760833, 1.3394714841463353, 1.665882880268285, 1.1289826907688656, 1.1919310183718634, 1.2424435229061515, 1.7549914294758464, 1.0687160422987512, 1.5230700164855386, 1.1685640929382648, 1.7045209128856311, 1.5720749430772625, 1.638338428104991, 1.6071797987923622, 1.4059765201551322, 1.8358957998550458, 1.9244628526410597, 1.374608662119257, 1.5707284156352224, 1.8668372268014402, 1.0429315200221432, 1.5172551376692867, 1.0436654125885156, 1.43684293718568, 1.7477344189482764, 1.783774805313826, 1.8856312405865596, 1.3976079199848404, 1.3665819561006955, 1.0442947631758392, 1.2706139382818769, 1.0713145907475492, 1.2705563394276185, 1.092721114597533, 1.1793859980743842, 1.6640643354639368, 1.6179775830861334, 1.367051106753896, 1.5564968877043222, 1.033273054674277, 1.722911673992134, 1.4849819859173812, 1.8274834202817463, 1.1860641581367335, 1.0168655126975352, 1.628227796800952, 1.0590083214221355, 1.523202270747594, 1.9532195834739616, 1.0307678623421779, 1.1854567675511396, 1.951758735594098, 1.3588334264981767, 1.4020820111967545, 1.9155598057169811, 1.9798279232514548, 1.1431426488398493, 1.7837044992392328, 1.816370606798356, 1.1072627001038533, 1.2607820228000524, 1.869991515515133, 1.066721850706113, 1.6881187329587757, 1.6512415515798042, 1.041501790327286, 1.735975769067809, 1.1797689258252044, 1.4947782130188565, 1.116409454765006, 1.5833377574280219, 1.0858690648653617, 1.9947243040764873, 1.7296148811503205, 1.1594649978452516, 1.4644912133253467, 1.1614253564443209, 1.0483566485355917, 1.8473105648690809, 1.3526565399116115, 1.7307014646817283, 1.6194358905482042, 1.5652799839182263, 1.1447668508582716, 1.0620863029507386, 1.0188566864673794, 1.1291698659963947, 1.8257872692798742, 1.2750643590025392, 1.1698248425738604, 1.745473601467766, 1.1633647132568756, 1.529048743708371, 1.81789566551916, 1.4628165699367952, 1.5346763365520781, 1.4748841156567107, 1.0290619498534412, 1.8018295002852298, 1.2020343638841589, 1.2407356865611623, 1.5145849552175974, 1.0413175422816505, 1.8021133867183357, 1.4348849981842688, 1.234624366616573, 1.999927054719527, 1.827420978207409, 1.778012811832104, 1.8804502360799338, 1.3763865871110328, 1.0403225138860221, 1.498949100916203, 1.0851618723595418, 1.674737260648853, 1.309070115834074, 1.4343727359349576, 1.9275848103994315, 1.5710460538836808, 1.3376475474381964, 1.5421943936567761, 1.4997886366093833, 1.0250096974885927, 1.348235433728513, 1.0034675363323844, 1.5329299222481207, 1.2251936431705386, 1.5625304848484647, 1.6525370855037305, 1.7818207391327814, 1.9917496126577996, 1.4569628133285613, 1.1398116749079727, 1.187670800087573, 1.0987562891016336, 1.8654408763102226, 1.8310239804760258, 1.4737003338102206, 1.743944290750049, 1.7521903809489885, 1.9904812458566825, 1.9149352104400752, 1.278350353909863, 1.8258807892660185, 1.6802296850764242, 1.742646866342255, 1.4344849618255715, 1.1256254186183927, 1.5112678382194156, 1.1403003740904336, 1.4316390266708459, 1.4263451342469808, 1.065000515216404, 1.4280769666457, 1.198689407637226, 1.6776228483229432, 1.4257507793938429, 1.167909961343911, 1.0579874834601999, 1.5768216592635318, 1.8123121333479175, 1.7451579149268766, 1.496139986280143, 1.0773580568549992, 1.472715035100353, 1.4489701115793157, 1.969449771231568, 1.1944098982814597, 1.6508110950068673, 1.8826400795085385, 1.3366305639594154, 1.952472410696649, 1.4550971231068814, 1.2108798055608867, 1.7473579282186107, 1.8254783899992373, 1.929642717975332, 1.8716101345213214, 1.350317981043475, 1.301988749311378, 1.0074673477529894, 1.4172177633052374, 1.456091911062001, 1.595361779986769, 1.5946239299889904, 1.2433101509428093, 1.8257698413693775, 1.961471317968724, 1.943786775970236, 1.2772902388567013, 1.8802725658661674, 1.6881892630756372, 1.3463676480352682, 1.3210723359829464, 1.2683434754648617, 1.2393265029732008, 1.1476348769512292, 1.2553721269522609, 1.4566260490425058, 1.4289815775611179, 1.779660157808742, 1.2715017185604833, 1.732366828862814, 1.9647580046050168, 1.7323588585750844, 1.6286749739445467, 1.2437462013968417, 1.6328411497102788, 1.078671244398605, 1.547166398942351, 1.9513290025735193, 1.6658723304260556, 1.4768413904542956, 1.6573158408666677, 1.9341577759387047, 1.2001076458822022, 1.8183063600134914, 1.0511019835517559, 1.2791503115204494, 1.548772072170224, 1.1855152704504948, 1.1685956928127474, 1.6240824406082122, 1.7654811519906517, 1.0536277699431675, 1.322445278444712, 1.1782554524996767, 1.898918060795364, 1.2573073365619467, 1.3784126366346425, 1.9500669753941304, 1.988516914431597, 1.8672095133360604, 1.5353743590577307, 1.633510127842435, 1.2785820043566023, 1.3101157436588002, 1.3663275882925128, 1.803213706577509, 1.6527163779516503, 1.066699644152605, 1.2243397018533402, 1.7428928482832777, 1.2924213158779108, 1.8564248190933113, 1.009521935199523, 1.1737766082258463, 1.0840397826083135, 1.754430637629579, 1.806030619969261, 1.3050665767268799, 1.0031204015923376, 1.2615063561524906, 1.8590125958147734, 1.6465676706054124, 1.7822653106136355, 1.0342015670582885, 1.3522267817767843, 1.5161926409547462, 1.7432811624072895, 1.9207686429854443, 1.2493220593544048, 1.448086093964304, 1.2716014662348523, 1.064555922280352, 1.8374571526503327, 1.1707037218641394, 1.061716353813334, 1.5756629980647106, 1.9385196099001136, 1.6204046832886605, 1.4407703356929105, 1.6354608911636508, 1.7417151773339736, 1.7419702824271197, 1.7375388907608054, 1.2052242401819655, 1.6331890989957776, 1.5816377791616498, 1.9802470866632578, 1.0649623424183092, 1.040593251540627, 1.2634654718610034, 1.2086532194998958, 1.3981175935010077, 1.322474902474889, 1.1398008977340113, 1.4667392418317968, 1.119867489681433, 1.020727898437209, 1.5554668366794286, 1.8931946528143109, 1.8919786848512765, 1.0930926481322762, 1.093774652357086, 1.415677399337373, 1.986375245854801, 1.56063896767223, 1.3425897338228672, 1.713938252331364, 1.9292048353041908, 1.0262358849854931, 1.148076259823657, 1.0943833240208625, 1.71371177375395, 1.5220292579756864, 1.0915356639770901, 1.470226082593004, 1.5701706916130798, 1.6988294640377042, 1.152808863774629, 1.9254872905431777, 1.6214365950362506, 1.171853236193465, 1.855183712498561, 1.5198011756512664, 1.1983443158993845, 1.6976488096260622, 1.1730676562280409, 1.3863147710650618, 1.35129181111984, 1.7443035511748486, 1.15150269370654, 1.5312060060987749, 1.360016911183454, 1.811848049872549, 1.172229678792781, 1.9890822749289763, 1.301134814030159, 1.1415193780502713, 1.4131493486984898, 1.9905487919575573, 1.4194094934051342, 1.6384275387179337, 1.409359153180444, 1.5210047946740515, 1.7032828826351236, 1.784865725336947, 1.7339010040424851, 1.4355987053186345, 1.9580065775947386, 1.5165297611177222, 1.8750556091661146, 1.4244616952637519, 1.2792791393766585, 1.2465348537047314, 1.2436780630202875, 1.2031811123699307, 1.0706755375964587, 1.8048489519757633, 1.5243711404711933, 1.561323046228053, 1.1125915888421718, 1.4578408140367578, 1.2456306726626918, 1.6903824572546113, 1.6504640113558295, 1.201475315368533, 1.5330813607469524, 1.0024290520601737, 1.3297125686330304, 1.1746446689885655, 1.8199574545571957, 1.132621961191099, 1.0616585857260163, 1.5451961994734893, 1.5229765810755513, 1.1817982924041106, 1.0487510884372089, 1.9617777127475087, 1.8790332197160464, 1.8268730446873183, 1.5085426877695838, 1.0314247456458054, 1.10351655271772, 1.3001262728829985, 1.1115344754147394, 1.2884748569011057, 1.2560153684196171, 1.4020048656921136, 1.0423086711226555, 1.957855396583296, 1.8650416934345535, 1.1697455707138444, 1.2672230945726035, 1.6918886886078797, 1.0838277004361185, 1.4797425966765072, 1.5994716273101455, 1.8753390535462198, 1.7328436106866019, 1.478716123216593, 1.105137611086993, 1.8706240832260435, 1.8578785713996244, 1.8236222716092323, 1.8805991646282527, 1.0082302596911579, 1.3876676387419373, 1.8838726274744138, 1.6025269526781414, 1.7939706299913398, 1.5808179101807198, 1.2082098158610117, 1.5928598283808943, 1.974151844117856, 1.0805351000394312, 1.6353602467432173, 1.843269622537563, 1.216447980654085, 1.8890018949293206, 1.5756149449194818, 1.2773076927526565, 1.29767284129442, 1.3972863115414131, 1.068431916133414, 1.2963233429488443, 1.611619165482359, 1.5558603268614652, 1.6770432205293395, 1.6821280943600472, 1.8986215197566347, 1.300637217731751, 1.1528128405616287, 1.764277668955546, 1.170918293914737, 1.7570264031359848, 1.7098246875569754, 1.2166808185068916, 1.6646812471068437, 1.843219042689454, 1.5379071534125528, 1.2616029501112145, 1.3965734353997177, 1.9787088905844565, 1.687735839519116, 1.8505161399625585, 1.6015780672806326, 1.1498037537847003, 1.678725966796233, 1.1255121680856854, 1.3260768304817538, 1.6405391097092907, 1.8019580791902245, 1.5438161012627347, 1.422961334440741, 1.1774606665674563, 1.4341220555740908, 1.097413208545631, 1.3761642628298876, 1.8713412160744682, 1.22598027443373, 1.185881044627342, 1.2637929463478055, 1.511497625012492, 1.6362921611693926, 1.5225943028129156, 1.5509815807403418, 1.8856713980991313, 1.9092308201472556, 1.4334369594067418, 1.0776094552903317, 1.465512000440732, 1.7662076163218117, 1.2806272094514126, 1.2010247288141231, 1.0011919470366275, 1.3402551930759665, 1.4946672847624762, 1.293474813118003, 1.0053205889444705, 1.7578980953515093, 1.8167824169118514, 1.220951787298872, 1.3057049334919386, 1.5166012419257118, 1.5766097208370875, 1.1977671617605425, 1.0670282106187163, 1.6158561620099818, 1.686084881911904, 1.679600530488758, 1.167826421505803, 1.4833867173491475, 1.5125642564754105, 1.1022313722020913, 1.4151956500776433, 1.8968965251966432, 1.7843585915097888, 1.2245888105805258, 1.0527513351334141, 1.737928819710181, 1.405712314292146, 1.1376988133489423, 1.5168796214628182, 1.4012354563952014, 1.0887568608127525, 1.8425785536941999, 1.952282864006574, 1.8873297649696643, 1.3881892925710233, 1.010127898832376, 1.975616518065365, 1.0782250966070879, 1.3302944958050662, 1.277852815790574, 1.1756777997738554, 1.1999222181566505, 1.0151069370118864, 1.1522857988862314, 1.43175735332723, 1.4419469997132242, 1.0772283384039703, 1.6076869851230644, 1.9161515307850339, 1.7512064091023651, 1.5834151722547947, 1.4121956965658409, 1.5464234731579098, 1.0660362904889635, 1.4894626659334138, 1.138242826025548, 1.1332975168045831, 1.082566940066428, 1.7624940670931908, 1.210615107505436, 1.549887869326919, 1.4756997235207123, 1.7444319759733968, 1.7619326878493258, 1.075182587765793, 1.7659084794969881, 1.6869459282707593, 1.5085398190444388, 1.1412585143804255, 1.4187187806756163, 1.9530222029268227, 1.9779429766189198, 1.0971789253953201, 1.4898191252446478, 1.8005931579136212, 1.1246650326461858, 1.039652579020725, 1.1274386581768268, 1.143603177289514, 1.8586350886380993, 1.8673558186311277, 1.4469113085646048, 1.5475120998072698, 1.1394475723383886, 1.8780221355259825, 1.2736835857324582, 1.5194602106486437, 1.861906653687326, 1.3845590380471924, 1.7226638645872834, 1.0681709799637757, 1.8210365644758393, 1.3965372540801295, 1.4486039179158763, 1.2803923161518265, 1.0965179286717663, 1.2322681428583457, 1.4973346249648738, 1.5797644883286879, 1.5141622282939917, 1.70646758790405, 1.991816042437766, 1.593720810938145, 1.7712309882065902, 1.7732371991896816, 1.2246710342041027, 1.3920553939413476, 1.3576939031102393, 1.0751637409423893, 1.538955888280093, 1.9960594796773978, 1.6041479073427276, 1.4531649112470333, 1.9585223104594516, 1.1371156331738206, 1.7409692256598015, 1.9302481717114126, 1.8273110243156983, 1.204377465786852, 1.0827410584205637, 1.1025572124180598, 1.3098359085400528, 1.4966503263994906, 1.979458577445048, 1.615914447565351, 1.1064833310700841, 1.457523053824572, 1.7814635359045976, 1.2583226451285763, 1.100394860207436, 1.0256019303963204, 1.8360100920822853, 1.4018823567760963, 1.4868428166182237, 1.599830151624812, 1.743028385371747, 1.4754418216559853, 1.186333383396463, 1.4532316910464014, 1.813693350973556, 1.3045790992806998, 1.2841933537899655, 1.034651733049102, 1.4817217710183754, 1.5036681750550165, 1.0661227217015419, 1.7227878447698126, 1.0998074208915338, 1.8936436288073368, 1.8076283028977689, 1.0927001212629628, 1.8587276944689328, 1.3026071124948828, 1.4278373479159865, 1.9274020399263274, 1.1144446350233481, 1.027993109121535, 1.2751907930358497, 1.654852720554279, 1.8804479772240932, 1.0398108907466352, 1.981306803242687, 1.0632526430599403, 1.5113043522035348, 1.9554584902733827, 1.9650844471588136, 1.5653905112699211, 1.1556294983975588, 1.0137916716285313, 1.4041044064557011, 1.7866906911847942, 1.098822679293014, 1.5198428106370474, 1.0194998575499241, 1.356736265207121, 1.0899138850487804, 1.0777607462250183, 1.6677374495427586, 1.625442135914267, 1.0044375614119812, 1.4422784694496882, 1.033259266574478, 1.3628052135523026, 1.7468618702842138, 1.585456252576679, 1.629419543803096, 1.6187832103232775, 1.1631129506949207, 1.033146418986758, 1.3159392631852607, 1.1864231738458035, 1.3692881844515998, 1.9102465764325378, 1.2823056978368557, 1.4063882797917284, 1.7255488240752548, 1.1267129155964655, 1.5641938490377671, 1.9938711772144568, 1.5300236162027692, 1.6723404832235043, 1.7675309803017347, 1.4759189206193557, 1.4181141951869636, 1.7420139179155687, 1.6745315044277356, 1.9559059587770113, 1.8954988698989563, 1.0926873362794864, 1.2129576041836956, 1.7605191877919726, 1.014550153748694, 1.266215482498028, 1.5771870094243399, 1.5717475535733607, 1.7000747652323898, 1.0876406841895798, 1.3842410689965778, 1.9040946312267133, 1.1763053376494303, 1.4378521288813735, 1.2789505294992842, 1.2657579744445884, 1.1041803952578402, 1.0038527641483328, 1.6059716959659214, 1.752832494840442, 1.0451903825757523, 1.1377159676074808, 1.011631088156618, 1.2190287247271605, 1.492155506912153, 1.8869702585759731, 1.3866510029728443, 1.0288081400128566, 1.7259872922958537, 1.8864411057991863, 1.1399944683412608, 1.8257022241401697, 1.260344761513024, 1.8377967662209538, 1.4346675845449746, 1.1139826968093207, 1.1764461288332888, 1.34073863673166, 1.1995492271371788, 1.0173788805776376, 1.1635558674980184, 1.306369249426487, 1.9897337701906233, 1.59859506492592, 1.251096404071835, 1.5306880468290696, 1.8906729386521266, 1.953042642994764, 1.2523324130765792, 1.8460652857001167, 1.1327160358937696, 1.0827669361603358, 1.7366479122437608, 1.4750014742445752, 1.2402485387466569, 1.8095437272697985, 1.7515910154914323, 1.5821824137360667, 1.7138005982264861, 1.3618501322210923, 1.879130063775776, 1.5158385299928188, 1.3575776973020006, 1.424281798264762, 1.997941328144677, 1.1741357294276247, 1.0648193722527297, 1.064047795703279, 1.1634624654099028, 1.6207023158070053, 1.2673381286887275, 1.5532238570777503, 1.3911432734036608, 1.4323112340829887, 1.6129357696875455, 1.7875238854296298, 1.7135063642995783, 1.6075078158497096, 1.1794334971056206, 1.84114451612747, 1.3410902816387564, 1.6070117115181664, 1.7580716498214333, 1.332958654164377, 1.7933797529283757, 1.0155780857482701, 1.914959193188193, 1.5651579212717766, 1.1198720314887745, 1.3783258704793084, 1.4311257746395467, 1.7492961345462765, 1.3622915892181102, 1.3203572755459836, 1.4576895026171943, 1.7222766043860287, 1.5599868540799333, 1.3315679709990633, 1.2746347950212882, 1.595541816885111, 1.1738136384632036, 1.5297087327881778, 1.7426718515708244, 1.3975329511343009, 1.878845098571845, 1.2539695521148086, 1.5357692710578326, 1.8880532772034084, 1.3248358162124025, 1.485373439518203, 1.9595601012554233, 1.0545469578972386, 1.6661733409257096, 1.1894653345497612, 1.447142608523212, 1.2019316577067503, 1.4443849987881947, 1.4081753432166453, 1.3258075588375733, 1.651131595812826, 1.7674244205172476, 1.868343621407023, 1.3028312131522355, 1.0521392016919688, 1.1622833854081012, 1.3716691328572803, 1.2753341862781726, 1.7241818300142726, 1.9794183486030859, 1.947379048251327, 1.6010743745456495, 1.6489739497677218, 1.2444530520740582, 1.8648231023651887, 1.9221318202137432, 1.0917996282046447, 1.8412410136749713, 1.2454977921823263, 1.48710728959757, 1.7379596525985783, 1.7355897070812343, 1.2170436979833457, 1.4355494312562411, 1.2340552843309633, 1.417645740000975, 1.6827290173954463, 1.5147164040117302, 1.1782849688464057, 1.9282649511753565, 1.6520675205861515, 1.2691533980769187, 1.2751284601214588, 1.5207911067934106, 1.915665477426779, 1.8956742582588721, 1.9632229691784417, 1.426449223003898, 1.490283611809939, 1.0098021863874291, 1.8430733450671355, 1.7175713934529002, 1.009898244487674, 1.2057668425733568, 1.1611319910348077, 1.1797440694545915, 1.9825659001236273, 1.679252003206474, 1.7047468109031287, 1.0335429041030488, 1.0265211324296533, 1.6003638152255515, 1.2167162689111126, 1.6234181132623622, 1.662382471255784, 1.2391932697055013, 1.8050306098487787, 1.6633691447617223, 1.9009311945899687, 1.42289723862615, 1.0735045683625604, 1.532850770129224, 1.2050498637969898, 1.7953960082494427, 1.0351218492358725, 1.1751217052549179, 1.8759748857811458, 1.8623568045451868, 1.7755828677789585, 1.5632774486658063, 1.3963502049319831, 1.24471083126263, 1.5105739965331637, 1.543270081398077, 1.2547873411802695, 1.8183796880832956, 1.9756670547639872, 1.1657741972591307, 1.8741135709332897, 1.8211316529381807, 1.6398481311788329, 1.3942587713082821, 1.4495038310420436, 1.3950848743220394, 1.881597439683494, 1.3397681218323554, 1.2300901725199183, 1.0170207348913467, 1.6391416656757047, 1.2842635094239563, 1.5599435179337198, 1.2137639178752913, 1.7103499368024502, 1.2729182547305689, 1.0996225348430568, 1.877456558468824, 1.6225077523693388, 1.5938219783637502, 1.489853226786315, 1.6013006095567142, 1.5242780828300118, 1.463316405180803, 1.6276141939945101, 1.7927452416018268, 1.2319724710400128, 1.640400183996115, 1.0780147786322687, 1.7766347687665918, 1.757623829515107, 1.9082429203895146, 1.2725450549942126, 1.292180977697388, 1.8745227852681186, 1.8513670431032139, 1.227803405754728, 1.2149831052191553, 1.4325789944484362, 1.4843148207406556, 1.736874576672792, 1.101079609238391, 1.598656407212871, 1.4420481164512435, 1.4616658534192257, 1.8648647577030495, 1.0705305637771605, 1.273030658431999, 1.46229555547884, 1.0578460635249374, 1.2761600242246172, 1.2100229566123533, 1.3918221946404958, 1.0717850656639487, 1.907673452959641, 1.316462545740558, 1.8960778942590286, 1.2085102571549982, 1.0020501804396678, 1.474174537106701, 1.092832357116907, 1.978901997946341, 1.5836198329370512, 1.291705852493417, 1.5095412111730053, 1.7066114143023159, 1.956663237185397, 1.1157148141177748, 1.7399543130079131, 1.0235588829885203, 1.1716100357499941, 1.5089257767238125, 1.8667472908339808, 1.9108806171275425, 1.4965862456878423, 1.8463137282087811, 1.5487871468074068, 1.4387348033547271, 1.241433058869851, 1.4877417751118087, 1.5735298881624766, 1.2499338083893818, 1.5414719317645849, 1.4421219941225205, 1.15557693941852, 1.1707792584353423, 1.8898212563232932, 1.5739935646276304, 1.5104955345755806, 1.0081565534785346, 1.7326659221035914, 1.0338933722715928, 1.5759909844816224, 1.088399995195991, 1.7153440109544331, 1.5942813059454721, 1.3508642446753771, 1.6852534805669572, 1.6239604569519748, 1.0466224226628318, 1.7556403577628783, 1.6726500113982405, 1.7518370461077193, 1.7379307992458062, 1.1391795904768627, 1.7352113095127282, 1.2631758734460228, 1.458804412366608, 1.084063039343541, 1.0907149829049485, 1.8176345470452522, 1.63656992259018, 1.4010982238817393, 1.11760973989326, 1.1080005505262438, 1.1285403730930477, 1.9674582538942809, 1.6211169406850938, 1.9121506852589496, 1.5673754403677138, 1.0047975264853115, 1.6639617687855228, 1.7578711127506257, 1.8978154603662143, 1.2134333611771773, 1.161837407036548

Update with valid data

omfpw.write_blockmodel_attribute(blockmodel_name='vol', series=blocks['random attr'] / 4, allow_overwrite=True)

blocks: pd.DataFrame = OMFPandasReader(filepath=temp_omf_path).read_blockmodel(blockmodel_name='vol')
blocks.head()
random attr
x y z dx dy dz
10.5 10.5 -9.5 1.0 1.0 1.0 0.727986
11.5 10.5 -9.5 1.0 1.0 1.0 0.277389
12.5 10.5 -9.5 1.0 1.0 1.0 0.351741
13.5 10.5 -9.5 1.0 1.0 1.0 0.999272
14.5 10.5 -9.5 1.0 1.0 1.0 0.495092


View the changelog

omfpw.changelog
element action description user timestamp
0 vol create BlockModel written runner 2024-08-08 23:37:29.193841
1 vol create Attribute [random attr] written runner 2024-08-08 23:37:29.248842


Clean up

temp_omf_path.unlink()

Total running time of the script: (0 minutes 0.138 seconds)

Gallery generated by Sphinx-Gallery