komanawa.basgra_nz_py.computational_resourse_use.test_memory_use#
a test for the memory usage, to use this script the memory profiler must be installed… https://pypi.org/project/memory-profiler/
$ pip install -U memory_profiler
Author: Matt Hanson Created: 23/11/2020 9:50 AM
Functions#
|
python wrapper for the fortran BASGRA code changes to the fortran code may require changes to this function runs the model for the period of the weather data |
Module Contents#
- run_basgra_nz(params, matrix_weather, days_harvest, doy_irr, verbose=False, supply_pet=True, auto_harvest=False, run_365_calendar=False, binname='gfortran-12', recompile=False, compile_verbose=False)[source]#
python wrapper for the fortran BASGRA code changes to the fortran code may require changes to this function runs the model for the period of the weather data
- Parameters:
params – dictionary, see input_output_keys.py, Komanawa-Solutions-Ltd/BASGRA_NZ_PY for more details
matrix_weather – pandas dataframe of weather data, maximum entries set in _max_weather_size in line 24 of this file (currently 36600) see documentation for input columns at Komanawa-Solutions-Ltd/BASGRA_NZ_PY , note expected DOY will change depending on expect_no_leap_days
days_harvest – days harvest dataframe must be same length as matrix_weather entries see documentation for input columns at Komanawa-Solutions-Ltd/BASGRA_NZ_PY , note expected DOY will change depending on expect_no_leap_days
doy_irr – a list of the days of year to irrigate on, must be integers acceptable values: (0-366)
verbose – boolean, if True the fortran function prints a number of statements for debugging purposes(depreciated)
supply_pet – boolean, if True BASGRA expects pet to be supplied, if False the parameters required to calculate pet from the peyman equation are expected, the version must match the DLL if dll_path != ‘default’
auto_harvest – boolean, if True then assumes data is formated correctly for auto harvesting, if False, then assumes data is formatted for manual harvesting (e.g. previous version) and re-formats internally
run_365_calendar – boolean, if True then run on a 365 day calender This expects that all leap days will be removed from matrix_weather and days_harvest. DOY is expected to be between 1 and 365. This means that datetime objects defined by year and doy will be incorrect. instead use get_month_day_to_nonleap_doy to map DOY to datetime via month and day. This is how the index of the returned datetime will be passed. For example for date 2024-03-01 (2024 is a leap year) the dayofyear via a datetime object will be 61, but if expect_no_leap_days=True basgra expects day of year to be 60. the index of the results will be a datetime object of equivalent to 2024-03-01, so the output doy will not match the index doy and there will be no value on 2020-02-29. default False
binname – str, the name of the gfortran compiler to use, default ‘gfortran-12’
recompile – bool, if True force recompile the fortran code
compile_verbose – bool, if True print the fortran compilation output
- Returns:
pd.DataFrame(index=datetime index, columns = out_cols)