Adding support for timestep resolutino other than 1hr
Currently TopoPyScale supports only timeseries of 1hr. It would be convenient to add support of 3hr or 6 hr input data. This is in part a follow up of issue #41
@ArcticSnow i will now implement 3H /6H timestep support. I think this only applies to accumulated variables TP,LW and SW. As far as I can see TP is already divided by timestep here:
down_pt['tp'] = down_pt.precip_lapse_rate * surf_interp.tp * 1 / meta.get('tstep') * 10 ** 3 # Convert to mm/hr
https://github.com/ArcticSnow/TopoPyScale/blob/ac8d71adc73b4d14501e2211abbd44a4b78a05d3/TopoPyScale/topo_scale.py#L184
I need to edit all instances of pd.Timedelta in radiation section, such as:
surf_interp['cle'] = (surf_interp.strd / pd.Timedelta('1H').seconds) / (sbc * surf_interp.t2m ** 4) - \
https://github.com/ArcticSnow/TopoPyScale/blob/ac8d71adc73b4d14501e2211abbd44a4b78a05d3/TopoPyScale/topo_scale.py#L251
can you think of anything else?
neat!
check also here:
-
def get_solar_geom()insolar_geom.py -
fetch_era5()can also be altered that it downloads less data too. line 51 offetch_era5.py - And finally it may be good to define this
tstepparameter in the config.yml file. So check how you may transfer the info from the yml to the routine via the topoclass.
This is all I can think of it may affect.
solar_geom.py alreadzy has tstep defined:
def get_solar_geom(df_position, start_date, end_date, tstep, sr_epsg="4326", num_threads=None, fname='ds_solar.nc', project_ouput=Path('./'), method_solar='nrel_numpy'): """ Function to compute solar position for each location given in the dataframe azimuth is define with 0 towards South, negative in W-dir, and posiive towards E-dir
Args:
df_position (dataframe): point_name as index, latitude, longitude
start_date (str): start date "2014-05-10"
end_date (str: end date "2015-05-10"
tstep (str): time step, ex: '6H'
sr_epsg (str): source EPSG code for the input coordinate
num_threads (int): number of threads to parallelize computation on. default is number of core -2
fname (str): name of netcdf file to store solar geometry
project_ouput (str): path to project root directory
nb: all accumulated variable are accumulated over 1H - therefore:
- TP is now multplied by timestep to get approximation of full precip budget. No need to deaccumulate as we want mm/hr.
- RAD (all) is divided by 3600 to get flux W/m2