Zoned Rectangles

This documents the contents, creation and access of the zoned rectangle library. See Generate Zoned Rectangle for an example of how the gFunctionDatabase.coordinate_generator.ZonedRectangle() class operates.

Contents

The following is a pseudo code for loop for the zoned rectangular fields currently in the library.

For i = 4 To 28
    For j = i To 32
        Nx = i
        Ny = j
        Call ZonedRectangleGenerate(Nx, Ny)
    EndFor
EndFor

The entire library is computed at B=5m spacing. The library took 254 days of computing time using cpgfunctions adaptive discretization scheme.

Create Library File

Here’s an example of how to provide the path/to/output/ directory containing cpgfunction output files. The files are merged into a single library.json file.

 1# Jack C. Cook
 2# Wednesday, February 10, 2021
 3
 4"""
 5output_to_library.py
 6
 7This will exemplify the methods for interacting with cppgfunction output folders
 8for the following libraries:/media/jackcook/SHARED/Documents/Oklahoma_State/Masters/Research/cpgfunction/README.md
 9- Zoned Rectangles
10"""
11
12import gFunctionDatabase as gfl
13
14
15def main():
16    # show example of extracting features from a U configurationgmai
17    # -------------- U-configuration Example ----------------
18    path_to_file = 'Partial_Libraries/U_Output_Partial/U_7_x_12_3.json'
19    data = gfl.fileio.js_r(path_to_file)
20    bf = gfl.handle_contents.Borefield(data)
21    u_info = gfl.featurerecognition.recognize_features(bf, lib_type='U')
22    print(u_info)
23
24    path_to_folder = 'Partial_Libraries/U_Output_Partial/'
25    u_lib = gfl.folder_to_lib.FolderToLib(path_to_folder, lib_type='U')
26    report_info = u_lib.create_report()
27    gfl.fileio.export_dict(report_info, 'U_configruations.xlsx')
28    u_lib_data = u_lib.create_lib_file()
29    gfl.fileio.export_dict(u_lib_data, 'U_configurations_5m.json')
30    # -----------------------------------------------------
31    # ----------- Open-configuration Example --------------
32    path_to_file = 'Partial_Libraries/Open_Output_Partial/ORect_7_x_7_3.json'
33    data = gfl.fileio.js_r(path_to_file)
34    bf = gfl.handle_contents.Borefield(data)
35    O_info = gfl.featurerecognition.recognize_features(bf, lib_type='Open')
36    print(O_info)
37
38    path_to_folder = 'Partial_Libraries/Open_Output_Partial/'
39    O_lib = gfl.folder_to_lib.FolderToLib(path_to_folder, lib_type='Open')
40    report_info = O_lib.create_report()
41    gfl.fileio.export_dict(report_info, 'Open_config_report.xlsx')
42    O_lib_data = O_lib.create_lib_file()
43    gfl.fileio.export_dict(O_lib_data, 'Open_configurations_5m.json')
44
45    # -----------------------------------------------------
46
47    # the following is depracated and needs updated
48    # # --------------- Uniform field Example -------------------
49    # # this is the same for rectangle, L, U, and Open rectangles
50    # example_folder = 'Partial_Libraries/Rectangle_Output_Partial'
51    # r_lib = gfl.folder_to_lib.FolderToLib(example_folder, lib_type='uniform')
52    # report = r_lib.create_report()  # create a dialogue of what will be going into the lib file
53    # gfl.fileio.export_dict(report, 'uniform.xlsx')  # export the report
54    # r_lib_file = r_lib.create_lib_file()  #
55    # gfl.fileio.export_dict(r_lib_file, 'rectangle_5m.json')
56    # # -----------------------------------------------------
57    # # --------------- Zoned Rectangle Example -------------
58    # example_folder = 'Zoned_Rectangle_Outputs/'
59    # gfl.fileio.create_dir_if_not(example_folder)
60    # # provide a path to .json output files from cpgfunction
61    # path_to_output = 'Partial_Libraries/Zoned_Rectangle_Output_Partial/'
62    #
63    # # Create an xlsx file detailing the contents of the output_folder/
64    # zr_f_to_lib = gfl.folder_to_lib.FolderToLib(path_to_output, lib_type='zoned')
65    # zr_report_info = zr_f_to_lib.create_report()
66    # # export the contents to an excel file
67    # gfl.fileio.export_dict(zr_report_info, example_folder + 'ZRect_Report.xlsx')
68    # lib_file = zr_f_to_lib.create_lib_file()
69    # gfl.fileio.export_dict(lib_file, example_folder + 'zoned_rectangle_example_lib.json')
70
71    # -----------------------------------------------------
72
73
74if __name__ == '__main__':
75    main()

Library Access

Provide functions for accessing the zoned rectangular library.