ERA output to GSSHA input (ERAtoGSSHA)¶
- https://software.ecmwf.int/wiki/display/CKB/What+is+ERA5
- http://www.ecmwf.int/en/research/climate-reanalysis/era-interim
ERAtoGSSHA¶
-
class
gsshapy.grid.
ERAtoGSSHA
(gssha_project_folder, gssha_project_file_name, lsm_input_folder_path, lsm_search_card='*.nc', lsm_lat_var='latitude', lsm_lon_var='longitude', lsm_time_var='time', lsm_lat_dim='latitude', lsm_lon_dim='longitude', lsm_time_dim='time', output_timezone=None, download_start_datetime=None, download_end_datetime=None, era_download_data='era5')[source]¶ Bases:
gsshapy.grid.grid_to_gssha.GRIDtoGSSHA
This class converts the ERA5 or ERA Interim output data to GSSHA formatted input. This class inherits from class:GRIDtoGSSHA.
Note
https://software.ecmwf.int/wiki/display/CKB/How+to+download+ERA5+test+data+via+the+ECMWF+Web+API
-
gssha_project_folder
¶ str
– Path to the GSSHA project folder
-
gssha_project_file_name
¶ str
– Name of the GSSHA elevation grid file.
-
lsm_input_folder_path
¶ str
– Path to the input folder for the LSM files.
-
lsm_lat_var
¶ Optional[
str
] – Name of the latitude variable in the LSM netCDF files. Defaults to ‘lat’.
-
lsm_lon_var
¶ Optional[
str
] – Name of the longitude variable in the LSM netCDF files. Defaults to ‘lon’.
-
lsm_time_var
¶ Optional[
str
] – Name of the time variable in the LSM netCDF files. Defaults to ‘time’.
-
lsm_lat_dim
¶ Optional[
str
] – Name of the latitude dimension in the LSM netCDF files. Defaults to ‘lat’.
-
lsm_lon_dim
¶ Optional[
str
] – Name of the longitude dimension in the LSM netCDF files. Defaults to ‘lon’.
-
lsm_time_dim
¶ Optional[
str
] – Name of the time dimension in the LSM netCDF files. Defaults to ‘time’.
-
output_timezone
¶ Optional[
tzinfo
] – This is the timezone to output the dates for the data. Default is he GSSHA model timezone. This option does NOT currently work for NetCDF output.
-
download_start_datetime
¶ Optional[
datetime.datetime
] – Datetime to start download.
-
download_end_datetime
¶ Optional[
datetime.datetime
] – Datetime to end download.
-
era_download_data
¶ Optional[
str
] – You can choose ‘era5’ or ‘interim’. Defaults to ‘era5’.
Example:
from datetime import datetime from gsshapy.grid import ERA5toGSSHA e2g = ERA5toGSSHA(gssha_project_folder='E:\GSSHA', gssha_project_file_name='gssha.prj', lsm_input_folder_path='E:\GSSHA\era5-data', lsm_search_card="*.grib", #download_start_datetime=datetime(2016,1,2), #download_end_datetime=datetime(2016,1,4), ) out_gage_file = 'E:\GSSHA\era5_rain1.gag e2g.lsm_precip_to_gssha_precip_gage(out_gage_file, lsm_data_var="tp", precip_type="GAGES") data_var_map_array = [ ['precipitation_inc', 'tp'], ['pressure', 'sp'], ['relative_humidity_dew', ['d2m','t2m']], ['wind_speed', ['u10', 'v10']], ['direct_radiation', 'aluvp'], ['diffusive_radiation', 'aluvd'], ['temperature', 't2m'], ['cloud_cover', 'tcc'], ] e2g.lsm_data_to_arc_ascii(data_var_map_array)
-
Download ERA¶
-
gsshapy.grid.era_to_gssha.
download_era5_for_gssha
(main_directory, start_datetime, end_datetime, leftlon=-180, rightlon=180, toplat=90, bottomlat=-90, precip_only=False)[source]¶ Function to download ERA5 data for GSSHA
Parameters: - main_directory (
str
) – Location of the output for the forecast data. - start_datetime (
str
) – Datetime for download start. - end_datetime (
str
) – Datetime for download end. - leftlon (Optional[
float
]) – Left bound for longitude. Default is -180. - rightlon (Optional[
float
]) – Right bound for longitude. Default is 180. - toplat (Optional[
float
]) – Top bound for latitude. Default is 90. - bottomlat (Optional[
float
]) – Bottom bound for latitude. Default is -90. - precip_only (Optional[bool]) – If True, will only download precipitation.
Example:
from gsshapy.grid.era_to_gssha import download_era5_for_gssha era5_folder = '/era5' leftlon = -95 rightlon = -75 toplat = 35 bottomlat = 30 download_era5_for_gssha(era5_folder, leftlon, rightlon, toplat, bottomlat)
- main_directory (
-
gsshapy.grid.era_to_gssha.
download_interim_for_gssha
(main_directory, start_datetime, end_datetime, leftlon=-180, rightlon=180, toplat=90, bottomlat=-90, precip_only=False)[source]¶ Function to download ERA5 data for GSSHA
Parameters: - main_directory (
str
) – Location of the output for the forecast data. - start_datetime (
str
) – Datetime for download start. - end_datetime (
str
) – Datetime for download end. - leftlon (Optional[
float
]) – Left bound for longitude. Default is -180. - rightlon (Optional[
float
]) – Right bound for longitude. Default is 180. - toplat (Optional[
float
]) – Top bound for latitude. Default is 90. - bottomlat (Optional[
float
]) – Bottom bound for latitude. Default is -90. - precip_only (Optional[bool]) – If True, will only download precipitation.
Example:
from gsshapy.grid.era_to_gssha import download_era_interim_for_gssha era_interim_folder = '/era_interim' leftlon = -95 rightlon = -75 toplat = 35 bottomlat = 30 download_era_interim_for_gssha(era5_folder, leftlon, rightlon, toplat, bottomlat)
- main_directory (