Source code for pycif.plugins.datastreams.fluxes.wrfchem.get_domain

from .....utils.classes.setup import Setup


[docs] def get_domain(ref_dir, ref_file, input_interval, target_dir, tracer=None): """Not used VERSION HISTORY 2021-08-20 freum Original from flux_template_plugin, raising NotImplementedError at beginning """ # Inputs: # --------- # ref_dir: directory where the original files are found # ref_file: (template) name of the original files # input_interval: list of the periods to simulate, each item is the list of the dates of the period # target_dir: directory where the links to the orginal files are created # # Ouputs: # --------- # setup of the domain in section "Initializes domain" raise NotImplementedError("Not used") print('Here, read the horizontal grid e.g. longitudes and latitudes') print('Several possibilities: read a reference file, read a file among ') print('the available data files, read a file specified in the yaml XXXah bon? Comment?XXX') print('Domain file for template fluxes:', domain_file) print('From this file, obtain the coordinates of the centers and/or the corners of the grid cells') print('If corners or centers are not available, deduce them from the available information') print('WARNING: the grid must not be overlapping e.g for a global grid, the last grid cell must not be the same as the first') print('Order the centers and corners latitudes and longitudes increasing order') print('Get the min and max latitude and longitude of centers + the number of longitudes and latitudes') print('Here, read the vertical information, from the same file as the horizontal information or from another') print('Get the number of vertical levels') print('Get or deduce the coefficients XXX et si on n\'est pas en sigma??XXX from bottom to top.') print('If no vetical dimension for emissions, provide dummy vertical') # punit = "Pa" # nlevs = 1 # sigma_a = np.array([0]) # sigma_b = np.array([1]) # Initializes domain setup = Setup.from_dict( { "domain": { "plugin": { "name": "dummy", "version": "std", "type": "domain", }, "xmin": lon_min, # minimum longitude for centers "xmax": lon_max, # maximum longitude for centers "ymin": lat_min, # minimum latitude for centers "ymax": lat_max, # maximum latitude for centers "nlon": nlon, # number of longitudinal cells "nlat": nlat, # number of latitudinal cells "nlev": nlevs, # number of vertical levels "sigma_a": sigma_a, "sigma_b": sigma_b, "pressure_unit": "Pa" # adapted to sigmas } } ) Setup.load_setup(setup, level=1) # if lon and lat are vectors, convert into a grid with # zlon, zlat = np.meshgrid(lon, lat) setup.domain.zlon = zlon # longitudes of centers setup.domain.zlat = zlat # latitudes of centers setup.domain.zlonc = zlonc # longitudes of corners setup.domain.zlatc = zlatc # latitudes of corners return setup.domain