utils#

  • Copyright (c) 2023 Alexandre Gauvain, Ronan Abhervé, Jean-Raynald de Dreuzy

  • This program and the accompanying materials are made available under the

  • terms of the Eclipse Public License 2.0 which is available at

  • http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0

  • which is available at https://www.apache.org/licenses/LICENSE-2.0.

  • SPDX-License-Identifier: EPL-2.0 OR Apache-2.0

hydromodpy.pyhelp.utils.calc_dist_from_coord(lat1, lon1, lat2, lon2)[source]#

Compute the horizontal distance in km between a location given in decimal degrees and a set of locations also given in decimal degrees.

hydromodpy.pyhelp.utils.delete_folder_recursively(dirpath)[source]#

Try to delete all files and sub-folders below the given dirpath.

hydromodpy.pyhelp.utils.nan_as_text_tolist(arr)[source]#

Convert the float nan to text while converting a numpy 2d array to a list, so that it is possible to save to an Excel file.

hydromodpy.pyhelp.utils.save_content_to_csv(fname, fcontent, mode='w', delimiter=',', encoding='utf8')[source]#

Save fcontent in a csv file with the specifications provided in arguments.

hydromodpy.pyhelp.utils.savedata_to_hdf5(data, hdf5_filename, grid=None)[source]#

Save the data contains in a dictionary into a hdf5 file.