honeybee-radiance-postprocess 0.4.314__tar.gz → 0.4.315__tar.gz

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.
Files changed (39) hide show
  1. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/PKG-INFO +1 -1
  2. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/postprocess.py +56 -0
  3. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/results.py +43 -3
  4. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess.egg-info/PKG-INFO +1 -1
  5. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/CODE_OF_CONDUCT.md +0 -0
  6. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/CONTRIBUTING.md +0 -0
  7. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/LICENSE +0 -0
  8. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/MANIFEST.in +0 -0
  9. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/README.md +0 -0
  10. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/dev-requirements.txt +0 -0
  11. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/__init__.py +0 -0
  12. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/__main__.py +0 -0
  13. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/annual.py +0 -0
  14. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/annualdaylight.py +0 -0
  15. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/__init__.py +0 -0
  16. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/grid.py +0 -0
  17. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/leed.py +0 -0
  18. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/mtxop.py +0 -0
  19. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/schedule.py +0 -0
  20. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/translate.py +0 -0
  21. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/two_phase.py +0 -0
  22. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/cli/util.py +0 -0
  23. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/dynamic.py +0 -0
  24. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/electriclight.py +0 -0
  25. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/en17037.py +0 -0
  26. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/helper.py +0 -0
  27. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/leed.py +0 -0
  28. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/metrics.py +0 -0
  29. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/reader.py +0 -0
  30. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/type_hints.py +0 -0
  31. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess/util.py +0 -0
  32. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess.egg-info/SOURCES.txt +0 -0
  33. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess.egg-info/dependency_links.txt +0 -0
  34. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess.egg-info/entry_points.txt +0 -0
  35. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess.egg-info/requires.txt +0 -0
  36. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/honeybee_radiance_postprocess.egg-info/top_level.txt +0 -0
  37. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/requirements.txt +0 -0
  38. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/setup.cfg +0 -0
  39. {honeybee-radiance-postprocess-0.4.314 → honeybee-radiance-postprocess-0.4.315}/setup.py +0 -0
@@ -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
@@ -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