eggshell.nc.ocg_utils

Module Contents

eggshell.nc.ocg_utils.LOGGER[source]
eggshell.nc.ocg_utils.temp_groups[source]
eggshell.nc.ocg_utils.call(resource=[], variable=None, dimension_map=None, agg_selection=True, calc=None, calc_grouping=None, conform_units_to=None, crs=None, memory_limit=None, prefix=None, regrid_destination=None, regrid_options='bil', level_range=None, geom=None, output_format_options=None, search_radius_mult=2.0, select_nearest=False, select_ugid=None, spatial_wrapping=None, t_calendar=None, time_region=None, time_range=None, dir_output=None, output_format='nc')[source]

Call OCGIS operation.

Parameters:
  • resource – Input netCDF file.
  • variable – variable in the input file to be picked
  • dimension_map – dimension map in case of unconventional storage of data
  • agg_selection – For aggregation of in case of mulitple polygons geoms
  • calc – ocgis calc syntax for calculation partion
  • calc_grouping – time aggregate grouping
  • cdover – OUTDATED use py-cdo (‘python’, by default) or cdo from the system (‘system’)
  • conform_units_to
  • crs – coordinate reference system
  • memory_limit – limit the amount of data to be loaded into the memory at once if None (default) free memory is detected by birdhouse
  • level_range – subset of given levels
  • prefix – string for the file base name
  • regrid_destination – file path with netCDF file with grid for output file
  • geom – name of shapefile stored in birdhouse shape cabinet
  • output_format_options – output options for netCDF e.g compression level()
  • regrid_destination – file containing the targed grid (griddes.txt or netCDF file)
  • regrid_options – methods for regridding: ‘bil’ = Bilinear interpolation ‘bic’ = Bicubic interpolation ‘dis’ = Distance-weighted average remapping ‘nn’ = nearest neighbour ‘con’ = First-order conservative remapping ‘laf’ = largest area fraction reamapping
  • search_radius_mult – search radius for point geometries. All included gridboxes will be returned
  • select_nearest – nearest neighbour selection for point geometries
  • select_ugid – ugid for appropriate polygons
  • spatial_wrapping – how to handle coordinates in case of subsets, options: None (default), ‘wrap’, ‘unwrap’
  • time_region – select single month
  • time_range – sequence of two datetime.datetime objects to mark start and end point
  • (default= curdir) (dir_output) –
  • output_format
Returns:

output file path

eggshell.nc.ocg_utils.calc_grouping(grouping)[source]

translate time grouping abbreviation (e.g ‘JJA’) into the appropriate ocgis calc_grouping syntax

Parameters:grouping – time group abbreviation allowed values: “yr”, “mon”, “sem”, “ONDJFM”, “AMJJAS”, “DJF”, “MAM”, “JJA”, “SON”
Returns list:calc_grouping conformant to ocgis syntax
eggshell.nc.ocg_utils.get_variable(resource)[source]

detects processable variable name in netCDF file based on ocgis (compare guess_main_variables)

Parameters:resource – filepath sting or sorted list for netcdf file(s)
Returns str:variable name
eggshell.nc.ocg_utils.has_variable(resource, variable)[source]