You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
only take single quantity as input and also update all other code.
consider making open_dataset_extra() private
Check resulting bc-files with code below:
importosimportdfm_toolsasdfmtimporthydrolib.core.dflowfmashcdfm## inputmodel_name='Bonaire'dir_output=r'c:\Users\veenstra\Downloads\modelbuilder_test'path_style='windows'# windows / unix, making relative paths only works when path_style is equal to osoverwrite=False# used for downloading of forcing data. Always set to True when changing the domaincrs='EPSG:4326'# domain and resolutionlon_min, lon_max, lat_min, lat_max=-68.55, -67.9, 11.8, 12.6dxy=0.05#dates as understood by pandas.period_range(). ERA5 has freq='M' (month) and CMEMS has freq='D' (day)date_min='2022-11-01'date_max='2022-11-03'ref_date='2022-01-01'# make dirsos.makedirs(dir_output, exist_ok=True)
dir_output_data=os.path.join(dir_output, 'data')
os.makedirs(dir_output_data, exist_ok=True)
mk_object=dfmt.make_basegrid(lon_min, lon_max, lat_min, lat_max, dx=dxy, dy=dxy, crs=crs)
# generate plifile from grid extent and coastlinesbnd_gdf=dfmt.generate_bndpli_cutland(mk=mk_object, res='h', buffer=0.01)
bnd_gdf_interp=dfmt.interpolate_bndpli(bnd_gdf,res=0.06)
pli_polyfile=dfmt.geodataframe_to_PolyFile(bnd_gdf_interp, name=f'{model_name}_bnd')
poly_file=os.path.join(dir_output, f'{model_name}.pli')
pli_polyfile.save(poly_file)
#%% new ext: initial and open boundary conditionext_file_new=os.path.join(dir_output, f'{model_name}_new.ext')
ext_new=hcdfm.ExtModel()
# CMEMS - download# check dfmt.get_conversion_dict() for an overview of parameter/quantity namesdir_output_data_cmems=os.path.join(dir_output_data, 'cmems')
os.makedirs(dir_output_data_cmems, exist_ok=True)
# for varkey in ['zos','so','thetao','uo','vo','no3']:#,'phyc']: # TODO: phyc not available in reanalysis: https://github.com/Deltares/dfm_tools/issues/847# dfmt.download_CMEMS(varkey=varkey,# longitude_min=lon_min, longitude_max=lon_max, latitude_min=lat_min, latitude_max=lat_max,# date_min=date_min, date_max=date_max,# dir_output=dir_output_data_cmems, file_prefix='cmems_', overwrite=overwrite)# CMEMS - boundary conditions file (.bc) (and add to ext_bnd)list_quantities= ['waterlevelbnd','salinitybnd','temperaturebnd','uxuyadvectionvelocitybnd','tracerbndNO3']#,'tracerbndPON1']list_quantities= ['uxuyadvectionvelocitybnd']#,'tracerbndPON1']dir_pattern=os.path.join(dir_output_data_cmems,'cmems_{ncvarname}_*.nc')
ext_new=dfmt.cmems_nc_to_bc(ext_bnd=ext_new,
refdate_str=f'minutes since {ref_date} 00:00:00 +00:00',
dir_output=dir_output,
list_quantities=list_quantities,
tstart=date_min,
tstop=date_max,
file_pli=poly_file,
dir_pattern=dir_pattern)
The text was updated successfully, but these errors were encountered:
Todo:
open_dataset_extra()
privateCheck resulting bc-files with code below:
The text was updated successfully, but these errors were encountered: