honeybee-radiance-postprocess 0.4.314__py2.py3-none-any.whl → 0.4.315__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -492,6 +492,62 @@ def annual_to_data(
492
492
  sys.exit(0)
493
493
 
494
494
 
495
+ @post_process.command('point-in-time')
496
+ @click.argument(
497
+ 'folder',
498
+ type=click.Path(exists=True, file_okay=False, dir_okay=True, resolve_path=True)
499
+ )
500
+ @click.argument(
501
+ 'hoy', type=click.FLOAT
502
+ )
503
+ @click.option(
504
+ '--states', '-st', help='A JSON file with a dictionary of states. If states '
505
+ 'are not provided the default states will be used for any aperture groups.',
506
+ default=None, show_default=True,
507
+ type=click.Path(exists=False, file_okay=True, dir_okay=False, resolve_path=True)
508
+ )
509
+ @click.option(
510
+ '--grids-filter', '-gf', help='A pattern to filter the grids.', default='*',
511
+ show_default=True
512
+ )
513
+ @click.option(
514
+ '--total/--direct', is_flag=True, default=True, help='Switch between total '
515
+ 'and direct results. Default is total.'
516
+ )
517
+ @click.option(
518
+ '--sub-folder', '-sf', help='Optional relative path for subfolder to write output '
519
+ 'metric files.', default='metrics'
520
+ )
521
+ def point_in_time(
522
+ folder, hoy, states, grids_filter, total, sub_folder
523
+ ):
524
+ """Get point in time values.
525
+
526
+ \b
527
+ Args:
528
+ folder: Results folder. This folder is an output folder of annual daylight
529
+ recipe. Folder should include grids_info.json and sun-up-hours.txt. The
530
+ command uses the list in grids_info.json to find the result files for each
531
+ sensor grid.
532
+ hoy: An HOY (point-in-time) for which to get the point-in-time values.
533
+ """
534
+ try:
535
+ if states:
536
+ states = DynamicSchedule.from_json(states)
537
+
538
+ res_type = 'total' if total is True else 'direct'
539
+
540
+ results = Results(folder)
541
+ results.point_in_time_to_folder(
542
+ sub_folder, datetime=hoy, states=states, grids_filter=grids_filter,
543
+ res_type=res_type)
544
+ except Exception:
545
+ _logger.exception('Failed to point in time values.')
546
+ sys.exit(1)
547
+ else:
548
+ sys.exit(0)
549
+
550
+
495
551
  @post_process.command('annual-sunlight-exposure')
496
552
  @click.argument(
497
553
  'folder',
@@ -690,13 +690,13 @@ class Results(_ResultsFolder):
690
690
  return total, grids_info
691
691
 
692
692
  def point_in_time(
693
- self, datetime: Union[int, DateTime], states: DynamicSchedule = None,
693
+ self, datetime: Union[float, DateTime], states: DynamicSchedule = None,
694
694
  grids_filter: str = '*', res_type: str = 'total'
695
695
  ) -> type_hints.point_in_time:
696
696
  """Get point in time values.
697
697
 
698
698
  Args:
699
- datetime: Hour of the as an integer or DateTime object.
699
+ datetime: Hour of the year as a float or DateTime object.
700
700
  states: A dictionary of states. Defaults to None.
701
701
  grids_filter: The name of a grid or a pattern to filter the grids.
702
702
  Defaults to '*'.
@@ -707,7 +707,7 @@ class Results(_ResultsFolder):
707
707
  """
708
708
  grids_info = self._filter_grids(grids_filter=grids_filter)
709
709
 
710
- if isinstance(datetime, int):
710
+ if isinstance(datetime, float):
711
711
  dt = DateTime.from_hoy(datetime)
712
712
  elif isinstance(datetime, DateTime):
713
713
  dt = datetime
@@ -732,6 +732,46 @@ class Results(_ResultsFolder):
732
732
 
733
733
  return pit_values, grids_info
734
734
 
735
+ def point_in_time_to_folder(
736
+ self, target_folder: str, datetime: Union[float, DateTime],
737
+ states: DynamicSchedule = None, grids_filter: str = '*',
738
+ res_type: str = 'total'
739
+ ) -> type_hints.point_in_time:
740
+ """Get point in time values and write the values to a folder.
741
+
742
+ Args:
743
+ target_folder: Folder path to write annual metrics in. Usually this
744
+ folder is called 'metrics'.
745
+ datetime: Hour of the year as a float or DateTime object.
746
+ states: A dictionary of states. Defaults to None.
747
+ grids_filter: The name of a grid or a pattern to filter the grids.
748
+ Defaults to '*'.
749
+ res_type: Type of results to load. Defaults to 'total'.
750
+
751
+ Returns:
752
+ Tuple: A tuple with point in time values and grid information.
753
+ """
754
+ folder = Path(target_folder)
755
+ folder.mkdir(parents=True, exist_ok=True)
756
+
757
+ pit_values, grids_info = self.point_in_time(
758
+ datetime=datetime, states=states,
759
+ grids_filter=grids_filter, res_type=res_type)
760
+
761
+ metric_folder = folder.joinpath('point_in_time')
762
+
763
+ for count, grid_info in enumerate(grids_info):
764
+ d = pit_values[count]
765
+ full_id = grid_info['full_id']
766
+ output_file = metric_folder.joinpath(f'{full_id}.pit')
767
+ output_file.parent.mkdir(parents=True, exist_ok=True)
768
+ np.savetxt(output_file, d, fmt='%.2f')
769
+
770
+ info_file = metric_folder.joinpath('grids_info.json')
771
+ info_file.write_text(json.dumps(grids_info))
772
+
773
+ return pit_values, grids_info
774
+
735
775
  def average_values(
736
776
  self, hoys: list = [], states: DynamicSchedule = None, grids_filter: str = '*',
737
777
  res_type: str = 'total') -> type_hints.average_values:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: honeybee-radiance-postprocess
3
- Version: 0.4.314
3
+ Version: 0.4.315
4
4
  Summary: Postprocessing of Radiance results and matrices
5
5
  Home-page: https://github.com/ladybug-tools/honeybee-radiance-postprocess
6
6
  Author: Ladybug Tools
@@ -9,21 +9,21 @@ honeybee_radiance_postprocess/helper.py,sha256=txSnQDdJ98OhNmInZKF_R0EcTi1XFJjBF
9
9
  honeybee_radiance_postprocess/leed.py,sha256=5m13QSHHjmVxQxVXhE8AvzxKs5ocmxBNHxrjlv4KjYk,32966
10
10
  honeybee_radiance_postprocess/metrics.py,sha256=sb-eBbfy1W2je7ZyqYMyYUt8PRUDkMvB8w76Nl4LT0Y,13560
11
11
  honeybee_radiance_postprocess/reader.py,sha256=6myKzfGC1pO8zPixg1kKrKjPihHabTKUh2t5BlJvij0,2367
12
- honeybee_radiance_postprocess/results.py,sha256=huoaGQQGdXuDvp0a45ATK3paePWI-Df-gpEKDORPVh4,78331
12
+ honeybee_radiance_postprocess/results.py,sha256=7Xcw9Z7plX5c07fvSeDAa3_dQ7hoe3feWJt37I-Fld0,79992
13
13
  honeybee_radiance_postprocess/type_hints.py,sha256=sbCWVYtdCxu9RL7faU9EYVLScLtTenoQ92f_jzHoJzM,995
14
14
  honeybee_radiance_postprocess/util.py,sha256=ihUwSpMw-C2IkCgCOq5gVCOExa7idKZjWBWFKjfEv7I,5425
15
15
  honeybee_radiance_postprocess/cli/__init__.py,sha256=4RkpR91GPXWatDE4I_27ce-N4FwolQoO6WO7H24DMXE,777
16
16
  honeybee_radiance_postprocess/cli/grid.py,sha256=35MwXzL7xRfV5LgDicEEYSyDAZ7Qjlvd-cA3YDA7JAw,8984
17
17
  honeybee_radiance_postprocess/cli/leed.py,sha256=o10tYnp_eRLEX7QV6jHj6cVRQA_6zYg_v9bZGbHo3eo,3082
18
18
  honeybee_radiance_postprocess/cli/mtxop.py,sha256=UZJnjNpPjDmShy1-Mxos4H2vTUqk_yP3ZyaC1_LLFeI,5015
19
- honeybee_radiance_postprocess/cli/postprocess.py,sha256=68a3YhR6YJ5LrCf8FujL3u5S4D2oSmUSfA9ivrnzzWI,29806
19
+ honeybee_radiance_postprocess/cli/postprocess.py,sha256=jpL9peylvPO_CCguunxTwhTuSsA5ql1gSZJ8CEZabTA,31677
20
20
  honeybee_radiance_postprocess/cli/schedule.py,sha256=68c7uT-qmgfjpLTk0vGdHr7ilNI8ht4M904nMzXXn4w,3887
21
21
  honeybee_radiance_postprocess/cli/translate.py,sha256=18zkcGeRZALJ5Z82NEB3XZ-iEX2cHyneobGWV-IXWE0,6789
22
22
  honeybee_radiance_postprocess/cli/two_phase.py,sha256=1nZF4jyZ_C7CAfiHCz1UUOEwDaB4yOXr9ga0HIrhOB0,7033
23
23
  honeybee_radiance_postprocess/cli/util.py,sha256=Be9cGmYhcV2W37ma6SgQPCWCpWLLLlroxRYN_l58kY0,4077
24
- honeybee_radiance_postprocess-0.4.314.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
25
- honeybee_radiance_postprocess-0.4.314.dist-info/METADATA,sha256=g_D3AUEvcJkVFKkQDw3KAqKItAqbzCyIU5dlczrd0xM,2228
26
- honeybee_radiance_postprocess-0.4.314.dist-info/WHEEL,sha256=unfA4MOaH0icIyIA5oH6E2sn2Hq5zKtLlHsWapZGwes,110
27
- honeybee_radiance_postprocess-0.4.314.dist-info/entry_points.txt,sha256=gFtVPx6UItXt27GfEZZO00eOZChJJEL6JwGSAB_O3rs,96
28
- honeybee_radiance_postprocess-0.4.314.dist-info/top_level.txt,sha256=4-sFbzy7ewP2EDqJV3jeFlAFx7SuxtoBBELWaKAnLdA,30
29
- honeybee_radiance_postprocess-0.4.314.dist-info/RECORD,,
24
+ honeybee_radiance_postprocess-0.4.315.dist-info/LICENSE,sha256=hIahDEOTzuHCU5J2nd07LWwkLW7Hko4UFO__ffsvB-8,34523
25
+ honeybee_radiance_postprocess-0.4.315.dist-info/METADATA,sha256=Z6myK4joTabnZILvtR1FmgUGIBGiFdfpoCQAJP14CsI,2228
26
+ honeybee_radiance_postprocess-0.4.315.dist-info/WHEEL,sha256=unfA4MOaH0icIyIA5oH6E2sn2Hq5zKtLlHsWapZGwes,110
27
+ honeybee_radiance_postprocess-0.4.315.dist-info/entry_points.txt,sha256=gFtVPx6UItXt27GfEZZO00eOZChJJEL6JwGSAB_O3rs,96
28
+ honeybee_radiance_postprocess-0.4.315.dist-info/top_level.txt,sha256=4-sFbzy7ewP2EDqJV3jeFlAFx7SuxtoBBELWaKAnLdA,30
29
+ honeybee_radiance_postprocess-0.4.315.dist-info/RECORD,,