warsa.precipitation.seasonal_forecast.cfsr package

Submodules

warsa.precipitation.seasonal_forecast.cfsr.cfsr_monthly module

download_cfsr_hp_monthly_means_flxf(cfsr_dir)
extract_all_precipitation(cfsr_dir, prec_dir, layers)

Calls extract_precipitation for each grib2 file

Parameters:
  • cfsr_dir – directory of the monthly cfsr files
  • prec_dir – directory of the monthly precipitation rasters
  • layers
Returns:

extract_precipitation(r_in, r_out, layers=None, layer_number=0)

Extracts band 31 (‘PRATE’) from r_in (grb2) and save it into a raster file (tif)

Parameters:
  • r_in – directory of the monthly cfsr files
  • r_out – directory of the monthly precipitation rasters
  • layers
  • layer_number
Returns:

ftp_files(ftp=None, ftp_dir=None, last_file=None, prefix='')

flxf01.gdas.197901.grb2

warsa.precipitation.seasonal_forecast.cfsr.cfsv2_monthly_forecast module

create_shapefile_centroids(prec_dir, shp)

Create a shapefile with id composed of lon and lat: ‘P{:05d}_{:04d}’.format(int(lon*100), int(lat*100)), as well as the fields lon and lat

Parameters:
  • prec_dir – folder where precipitation in tif-format is stored
  • shp – output file name
Returns:

create_shapefile_polygons(prec_dir, shp)

Create a shapefile with id composed of lon and lat: ‘P{:05d}_{:04d}’.format(int(lon*100), int(lat*100)), as well as the fields lon and lat

Parameters:
  • prec_dir – folder where precipitation in tif-format is stored
  • shp – output file name
Returns:

create_timeseries(prec_dir, ts_dir, forecast_months)
Parameters:
  • prec_dir – directory with sub-directories containing precipitation tif-files
  • ts_dir – directory of resulting time-series
  • forecast_months – number of forecast months
Returns:

download_cfsv2_forecast_mm_9mon_flxf(cfs_dir, email_address)

Download flxf-files from cfs V2: up to 9 months monthly forecast. it keeps the folder structure found in nomads.ncdc.noaa.gov/modeldata/cfsv2_forecast_mm_9mon

Parameters:
  • cfs_dir – local directory where to save the downloaded data
  • email_address – used in ftp.login(‘anonymous’, email_address)
Returns:

extract_all_precipitation(cfsr_dir, prec_dir, layers=None, **kwargs)

Calls extract_precipitation for each grib2 file

Parameters:
  • cfsr_dir – directory of the monthly cfsr files
  • prec_dir – directory where extracted monthly precipitation rasters in tif-format are saved
  • layers – used to clip the rasters if given
Returns:

extract_precipitation_from_grib2(f_in, f_out, layers=None, **kwargs)

Extracts band 31 (‘PRATE’) from r_in (grb2) and save it into a raster file (tif)

Parameters:
  • f_in – directory of the monthly cfsr files
  • f_out – directory of the monthly precipitation rasters
  • layers
  • kwargs – see clip_by_vector
Returns:

warsa.precipitation.seasonal_forecast.cfsr.cfsv2_monthly_reforecast module

create_shapefile_centroids(prec_dir, shp)

Create a shapefile with id composed of lon and lat: ‘P{:05d}_{:04d}’.format(int(lon*100), int(lat*100)), as well as the fields lon and lat

Parameters:
  • prec_dir – folder where precipitation in tif-format is stored
  • shp – output file name
Returns:

create_shapefile_polygons(prec_dir, shp)

Create a shapefile with id composed of lon and lat: ‘P{:05d}_{:04d}’.format(int(lon*100), int(lat*100)), as well as the fields lon and lat

Parameters:
  • prec_dir – folder where precipitation in tif-format is stored
  • shp – output file name
Returns:

create_timeseries(prec_dir, ts_dir, forecast_months)
Parameters:
  • prec_dir – directory with sub-directories containing precipitation tif-files
  • ts_dir – directory of resulting time-series
  • forecast_months – number of forecast months
Returns:

download_cfsv2_reforecast_ts_9mon_prate(cfs_dir, email_address)

http://cfs.ncep.noaa.gov/cfsv2.info/CFSv2.Reforecast.Datasets.Whitepaper.doc

Download from CFS Reforecast “High-Priority” Subset Product: Time Series from 9-Month Runs Grid/Scale: Various Period of Record: 12Dec1981-31Mar2011 Model Cycle: 00Z, 06Z, 12Z, 18Z cycles, 1 out of 5 days Output Timestep: 6-Hourly, out ~9 months

Parameters:
  • cfs_dir
  • email_address
Returns:

extract_all_precipitation(cfsr_dir, prec_dir, layers=None, **kwargs)

Calls extract_precipitation for each grib2 file

Parameters:
  • cfsr_dir – directory of the monthly cfsr files
  • prec_dir – directory where extracted monthly precipitation rasters in tif-format are saved
  • layers – used to clip the rasters if given
Returns:

extract_precipitation_from_grib2(f_in, f_out, layers=None, **kwargs)

Extracts band 31 (‘PRATE’) from r_in (grb2) and save it into a raster file (tif)

Parameters:
  • f_in – directory of the monthly cfsr files
  • f_out – directory of the monthly precipitation rasters
  • layers
  • kwargs – see clip_by_vector
Returns:

Module contents