@@ -642,21 +642,34 @@ def _check_grid_placement_single(self, sampling_xyzgrid_lhr, amr_xyzgrid_at_lhr_
642642
643643
644644
645- def write_sampling_params (self , out = None , format = 'netcdf' , overwrite = False ):
645+ def write_sampling_params (self , out = None , format = 'netcdf' , terrain = None , overwrite = False ):
646646 '''
647647 Write out text that can be used for the sampling planes in an
648648 AMR-Wind input file
649649
650650 out: str
651651 Output path or full filename for Input file to be written
652652 to. If None, result is written to screen.
653+ format: str
654+ Format requested for the output to be saved from AMR-Wind. Options are
655+ native and netcdf
656+ terrain: bool (required)
657+ If the case contains terrain. If it does, mu_turb will also be requested. This
658+ is necessary to process terrain files and set NaN inside the terrain.
653659 overwrite: bool
654660 If saving to a file, whether or not to overwrite potentially
655661 existing file
656662 '''
657663 if format not in ['netcdf' ,'native' ]:
658664 raise ValueError (f'format should be either native or netcdf' )
659665
666+ if terrain == True :
667+ fields = 'velocity mu_turb'
668+ elif terrain == False :
669+ fields = 'velocity'
670+ else :
671+ raise ValueError (f'The `terrain` input should be explicitly set to True or False' )
672+
660673 # Write time step information for consistenty with sampling frequency
661674 s = f"time.fixed_dt = { self .dt } \n \n "
662675 # Write flow velocity info for consistency
@@ -674,7 +687,7 @@ def write_sampling_params(self, out=None, format='netcdf', overwrite=False):
674687 s += f"# ---- Low-res sampling parameters ----\n "
675688 s += f"{ self .postproc_name_lr } .output_format = { format } \n "
676689 s += f"{ self .postproc_name_lr } .output_frequency = { self .output_frequency_lr } \n "
677- s += f"{ self .postproc_name_lr } .fields = velocity # temperature tke \n "
690+ s += f"{ self .postproc_name_lr } .fields = { fields } \n "
678691 s += f"{ self .postproc_name_lr } .labels = { sampling_labels_lr_str } \n \n "
679692
680693 # Write out low resolution sampling plane info
@@ -692,7 +705,7 @@ def write_sampling_params(self, out=None, format='netcdf', overwrite=False):
692705 s += f"# ---- High-res sampling parameters ----\n "
693706 s += f"{ self .postproc_name_hr } .output_format = { format } \n "
694707 s += f"{ self .postproc_name_hr } .output_frequency = { self .output_frequency_hr } \n "
695- s += f"{ self .postproc_name_hr } .fields = velocity # temperature tke \n "
708+ s += f"{ self .postproc_name_hr } .fields = { fields } \n "
696709 s += f"{ self .postproc_name_hr } .labels = { sampling_labels_hr_str } \n "
697710
698711 # Write out high resolution sampling plane info
0 commit comments