Reference
This reference manual details functions, modules, and objects included in
joseki
, describing what they are and what they do.
joseki.accessor
¶
Accessor module.
joseki.accessor.JosekiAccessor
¶
Joseki accessor.
Source code in src/joseki/accessor.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 |
|
joseki.accessor.JosekiAccessor.air_molar_mass: xr.DataArray
property
¶
Compute air molar mass as a function of altitude.
Returns:
Type | Description |
---|---|
DataArray
|
Air molar mass. |
Notes
The air molar mass is given by:
where * \(x_{\mathrm{M}}\) is the mole fraction of molecule M, * \(m_{\mathrm{M}}\) is the molar mass of molecule M.
To compute the air molar mass accurately, the mole fraction of molecular nitrogen (N2), molecular oxygen (O2), and argon (Ar) are required. If these are not present in the dataset, they are computed using the assumption that the mole fraction of these molecules are constant with altitude and set to the following values:
- molecular nitrogen (N2): 0.78084
- molecular oxygen (O2): 0.209476
- argon (Ar): 0.00934
are independent of altitude.
Since nothing garantees that the mole fraction sum is equal to one, the air molar mass is computed as the sum of the mole fraction weighted molar mass divided by the sum of the mole fraction.
joseki.accessor.JosekiAccessor.column_mass_density: t.Dict[str, pint.Quantity]
property
¶
Compute column mass density.
Returns:
Type | Description |
---|---|
Dict[str, Quantity]
|
A mapping of molecule and column mass density. |
Notes
The column mass density is given by:
where
- \(N_{\mathrm{M}}\) is the column number density of molecule M,
- \(m_{\mathrm{M}}\) is the molecular mass of molecule M.
joseki.accessor.JosekiAccessor.column_number_density: t.Dict[str, pint.Quantity]
property
¶
Compute column number density.
Returns:
Type | Description |
---|---|
Dict[str, Quantity]
|
A mapping of molecule and column number density. |
Notes
The column number density is given by:
with
where
- \(z\) is the altitude,
- \(x_{\mathrm{M}}(z)\) is the mole fraction of molecule M at altitude \(z\),
- \(n(z)\) is the air number density at altitude \(z\),
- \(n_{\mathrm{M}}(z)\) is the number density of molecule M at altitude \(z\).
The integration is performed using the trapezoidal rule.
joseki.accessor.JosekiAccessor.is_valid
property
¶
Return True
if the dataset complies with the schema, else False
.
joseki.accessor.JosekiAccessor.mass_density_at_sea_level: t.Dict[str, pint.Quantity]
property
¶
Compute mass density at sea level.
Returns:
Type | Description |
---|---|
Dict[str, Quantity]
|
A mapping of molecule and mass density at sea level. |
joseki.accessor.JosekiAccessor.mass_fraction: xr.DataArray
property
¶
Extract mass fraction and tabulate as a function of (m, z).
Returns:
Type | Description |
---|---|
DataArray
|
Mass fraction. |
joseki.accessor.JosekiAccessor.mole_fraction: xr.DataArray
property
¶
Extract mole fraction and tabulate as a function of (m, z).
Returns:
Type | Description |
---|---|
DataArray
|
Mole fraction. |
joseki.accessor.JosekiAccessor.mole_fraction_at_sea_level: t.Dict[str, pint.Quantity]
property
¶
Compute mole fraction at sea level.
Returns:
Type | Description |
---|---|
Dict[str, Quantity]
|
A mapping of molecule and mole fraction at sea level. |
joseki.accessor.JosekiAccessor.molecules: t.List[str]
property
¶
Return list of molecules.
joseki.accessor.JosekiAccessor.number_density_at_sea_level: t.Dict[str, pint.Quantity]
property
¶
Compute number density at sea level.
Returns:
Type | Description |
---|---|
Dict[str, Quantity]
|
A mapping of molecule and number density at sea level. |
joseki.accessor.JosekiAccessor.drop_molecules(molecules)
¶
Drop molecules from dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
molecules |
List[str]
|
List of molecules to drop. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Dataset with molecules dropped. |
Source code in src/joseki/accessor.py
joseki.accessor.JosekiAccessor.rescale(factors, check_x_sum=False)
¶
Rescale molecules concentration in atmospheric profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factors |
MutableMapping[str, float]
|
A mapping of molecule and scaling factor. |
required |
check_x_sum |
bool
|
if True, check that mole fraction sums are never larger than one. |
False
|
Raises:
ValueError: if check_x_sum
is True
and the
dataset is not valid.
Returns:
Type | Description |
---|---|
Dataset
|
Rescaled dataset (new object). |
Source code in src/joseki/accessor.py
joseki.accessor.JosekiAccessor.rescale_to(target, check_x_sum=False)
¶
Rescale mole fractions to match target molecular total column densities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
Mapping[str, Quantity | dict | DataArray]
|
Mapping of molecule and target total column density.
Total column must be either a column number density
[ |
required |
check_x_sum |
bool
|
if True, check that mole fraction sums are never larger than one. |
False
|
Returns:
Type | Description |
---|---|
Dataset
|
Rescaled dataset (new object). |
Source code in src/joseki/accessor.py
joseki.accessor.JosekiAccessor.scaling_factors(target)
¶
Compute scaling factor(s) to reach specific target amount(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
MutableMapping[str, Quantity | dict | DataArray]
|
Mapping of molecule and target amount. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If a target amount has dimensions that are not supported. |
Returns:
Type | Description |
---|---|
MutableMapping[str, float]
|
Mapping of molecule and scaling factors. |
Notes
For each molecule in the target
mapping, the target amount is
interpreted, depending on its dimensions (indicated in square
brackets), as:
- a column number density [
length^-2
], - a column mass density [
mass * length^-2
], - a number density at sea level [
length^-3
], - a mass density at sea level [
mass * length^-3
], - a mole fraction at sea level [
dimensionless
]
The scaling factor is then evaluated as the ratio of the target amount with the original amount, for each molecule.
See Also
rescale
Source code in src/joseki/accessor.py
joseki.accessor.JosekiAccessor.validate(check_x_sum=False, ret_true_if_valid=False)
¶
Validate atmosphere thermophysical profile dataset schema.
Returns:
Type | Description |
---|---|
bool
|
|
Source code in src/joseki/accessor.py
joseki.accessor.molecular_mass(m)
¶
Return the average molecular mass of a molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m |
str
|
Molecule formula. |
required |
Returns:
Type | Description |
---|---|
Quantity
|
Average molecular mass. |
joseki.data
¶
Raw data files.
joseki.profiles.factory
¶
Profile factory module.
joseki.profiles.factory.ProfileFactory
¶
Profile factory class.
Source code in src/joseki/profiles/factory.py
joseki.profiles.factory.ProfileFactory.registered_identifiers: t.List[str]
property
¶
Registered profile identifiers.
Returns:
Type | Description |
---|---|
List[str]
|
List of registered profile identifiers. |
joseki.profiles.factory.ProfileFactory.create(identifier, **kwargs)
¶
Create a profile instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Profile identifier. |
required |
Returns:
Type | Description |
---|---|
Profile
|
Profile instance. |
Source code in src/joseki/profiles/factory.py
joseki.profiles.factory.ProfileFactory.register(identifier)
¶
Register a profile class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Profile identifier. |
required |
Returns:
Type | Description |
---|---|
Callable
|
Decorator function. |
Source code in src/joseki/profiles/factory.py
joseki.profiles.core
¶
Core module for atmosphere thermophysical profiles.
The Profile
abstract class defines the interface for atmosphere thermophysical
profiles.
The interp
function is used to interpolate an atmosphere thermophysical
profile on new altitude values.
joseki.profiles.core.Profile
¶
Bases: ABC
Abstract class for atmosphere thermophysical profiles.
Source code in src/joseki/profiles/core.py
joseki.profiles.core.Profile.to_dataset(z=None, interp_method=None, conserve_column=False, **kwargs)
abstractmethod
¶
Return the profile as a dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z |
Optional[Quantity]
|
Altitude grid. If the profile can be evaluated at arbitrary altitudes, this parameter is passed to the evaluating method for that profile. If the profile is defined on a fixed altitude grid, this parameter is used to interpolate the profile on the specified altitude grid. |
None
|
interp_method |
Optional[Mapping[str, str]]
|
Interpolation method for each variable.
If |
None
|
conserve_column |
bool
|
If |
False
|
kwargs |
Any
|
Parameters passed to lower-level methods. |
{}
|
Returns:
Type | Description |
---|---|
Dataset
|
Atmospheric profile. |
Source code in src/joseki/profiles/core.py
joseki.profiles.core.extrapolate(ds, z_extra, direction, method=DEFAULT_METHOD, conserve_column=False)
¶
Extrapolate an atmospheric profile to new altitude(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
Dataset
|
Initial atmospheric profile. |
required |
z_extra |
Quantity
|
Altitude(s) to extrapolate to. |
required |
direction |
str
|
Direction of the extrapolation, either "up" or "down". |
required |
method |
Dict[str, str]
|
Mapping of variable and interpolation method. If a variable is not in the mapping, the linear interpolation is used. By default, linear interpolation is used for all variables. |
DEFAULT_METHOD
|
conserve_column |
bool
|
If True, ensure that column densities are conserved. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If the extrapolation direction is not "up" or "down". |
Returns:
Type | Description |
---|---|
Dataset
|
Extrapolated atmospheric profile. |
Source code in src/joseki/profiles/core.py
joseki.profiles.core.interp(ds, z_new, method=DEFAULT_METHOD, conserve_column=False, **kwargs)
¶
Interpolate atmospheric profile on new altitudes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
Dataset
|
Atmospheric profile to interpolate. |
required |
z_new |
Quantity
|
Altitudes values at which to interpolate the atmospheric profile. |
required |
method |
Dict[str, str]
|
Mapping of variable and interpolation method. If a variable is not in the mapping, the linear interpolation is used. By default, linear interpolation is used for all variables. |
DEFAULT_METHOD
|
conserve_column |
bool
|
If True, ensure that column densities are conserved. |
False
|
kwargs |
Any
|
Parameters passed to |
{}
|
Returns:
Type | Description |
---|---|
Dataset
|
Interpolated atmospheric profile. |
Source code in src/joseki/profiles/core.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
joseki.profiles.core.regularize(ds, method=DEFAULT_METHOD, conserve_column=False, options=DEFAULT_OPTIONS, **kwargs)
¶
Regularize the profile's altitude grid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
Dataset
|
Initial atmospheric profile. |
required |
method |
Dict[str, str]
|
Mapping of variable and interpolation method. If a variable is not in the mapping, the linear interpolation is used. By default, linear interpolation is used for all variables. |
DEFAULT_METHOD
|
conserve_column |
bool
|
If True, ensure that column densities are conserved. |
False
|
options |
Dict[str, Union[int, str, Quantity]]
|
Options for the regularization. Mapping with possible keys: - "num": Number of points in the new altitude grid. - "zstep": Altitude step in the new altitude grid. If "auto", the minimum altitude step is used. |
DEFAULT_OPTIONS
|
kwargs |
Any
|
Keyword arguments passed to the interpolation function. |
{}
|
Returns:
Type | Description |
---|---|
Dataset
|
Regularized atmospheric profile. |
Source code in src/joseki/profiles/core.py
joseki.profiles.core.rescale_to_column(reference, ds)
¶
Rescale mole fraction to ensure that column densities are conserved.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reference |
Dataset
|
Reference profile. |
required |
ds |
Dataset
|
Profile to rescale. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Rescaled profile. |
Source code in src/joseki/profiles/core.py
joseki.profiles.core.select_molecules(ds, molecules)
¶
Select specified molecules in the profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
Dataset
|
Initial atmospheric profile. |
required |
molecules |
List[str]
|
List of molecules to select. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Atmospheric profile with exactly the specified molecules. |
Source code in src/joseki/profiles/core.py
joseki.profiles.schema
¶
Dataset schema for atmosphere thermophysical profiles.
The dataset schema defines the variables, coordinates and attributes that are expected in a dataset representing an atmosphere thermophysical profile.
joseki.profiles.schema.Schema
¶
Dataset schema for atmosphere thermophysical profiles.
Source code in src/joseki/profiles/schema.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
joseki.profiles.schema.Schema.convert(data_vars, coords, attrs)
¶
Convert input to schema-compliant dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_vars |
Mapping[str, Quantity]
|
Mapping of data variable names to quantities. |
required |
coords |
Mapping[str, Quantity]
|
Mapping of coordinate names to quantities. |
required |
attrs |
Mapping[str, str]
|
Mapping of attribute names to values. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Dataset with schema-compliant data variables, coordinates, and |
Dataset
|
attributes. |
Source code in src/joseki/profiles/schema.py
213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
joseki.profiles.schema.Schema.validate(ds, check_x_sum=False, ret_true_if_valid=False)
¶
Validate dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
Dataset
|
Dataset to validate. |
required |
check_x_sum |
bool
|
if True, check that mole fraction sums are never larger than one. |
False
|
ret_true_if_valid |
bool
|
make this method return True if the dataset is valid. Note that if the dataset is not valid, this method will raise an exception. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If the dataset does not match the schema. |
Returns:
Type | Description |
---|---|
Optional[bool]
|
None or bool: If |
Source code in src/joseki/profiles/schema.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
joseki.profiles.schema.mole_fraction_sum(ds)
¶
Compute the sum of mole fractions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
Dataset
|
Dataset. |
required |
Returns:
Type | Description |
---|---|
Quantity
|
The sum of mole fractions. |
Source code in src/joseki/profiles/schema.py
joseki.profiles.afgl_1986
¶
AFGL 1986 atmosphere's thermophysical profiles.
The profiles are generated from data files stored in joseki/data/afgl_1986
.
These data files correspond to tables 1a-f and 2a-d of the technical report
Anderson+1986.
joseki.profiles.afgl_1986.AFGL1986MidlatitudeSummer
¶
Bases: Profile
AFGL 1986 midlatitude summer atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.AFGL1986MidlatitudeWinter
¶
Bases: Profile
AFGL 1986 midlatitude winter atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.AFGL1986SubarcticSummer
¶
Bases: Profile
AFGL 1986 subarctic summer atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.AFGL1986SubarcticWinter
¶
Bases: Profile
AFGL 1986 subarctic winter atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.AFGL1986Tropical
¶
Bases: Profile
AFGL 1986 tropical atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.AFGL1986USStandard
¶
Bases: Profile
AFGL 1986 US Standard atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.Identifier
¶
Bases: Enum
AFGL 1986 atmospheric profile identifier enumeration.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.dataframe_to_dataset(df, identifier, additional_molecules=True)
¶
Convert the output of the parse
method to a xarray.Dataset
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
Atmospheric profile data. |
required |
identifier |
Identifier
|
Atmospheric profile identifier. |
required |
additional_molecules |
bool
|
If |
True
|
Returns:
Type | Description |
---|---|
Dataset
|
Atmospheric profile dataset. |
Notes
Use the z
column of the output pandas.DataFrame of read_raw_data
as data coordinate and all other columns as data variables.
All data variables and coordinates of the returned xarray.Dataset are
associated metadata (standard name, long name and units).
Raw data units are documented in the technical report AFGL Atmospheric
Constituent Profiles (0-120 km), Anderson et al., 1986
Anderson+1986.
dataset attributes are added.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.get_dataset(identifier, additional_molecules=True)
¶
Read data files for a given atmospheric profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
Identifier
|
Atmospheric profile identifier.
See
|
required |
additional_molecules |
bool
|
If |
True
|
Returns:
Type | Description |
---|---|
Dataset
|
Atmospheric profile dataset. |
Notes
Chain calls to
parse
and
dataframe_to_dataset
.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.parse(identifier)
¶
Parse table data files for a given atmospheric profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
Identifier
|
Atmospheric profile identifier. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Atmospheric profile dataset. |
Notes
Read the relevant raw data files corresponding to the atmospheric profile.
These raw data files correspond to tables 1 and 2 from the
technical report AFGL Atmospheric Constituent Profiles (0-120 km),
Anderson et al., 1986.
Each atmospheric profile has 5 tables, i.e. 5 raw data files, associated
to it.
Only the first of these tables is specific to each atmospheric profile.
All 5 raw data files are read into pandas.DataFrame
objects and
then concatenated after dropping the duplicate columns.
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.afgl_1986.to_dataset(identifier, z=None, interp_method=None, conserve_column=False, **kwargs)
¶
Helper Profile.to_dataset() method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
Identifier
|
AFGL 1986 atmosphere thermophysical profile identifier.
See
|
required |
z |
Optional[Quantity]
|
New level altitudes.
If |
None
|
interp_method |
Mapping[str, str]
|
Interpolation method for each data variable. Default is
|
None
|
conserve_column |
bool
|
If |
False
|
kwargs |
Any
|
Additional arguments passed to
|
{}
|
Returns:
Type | Description |
---|---|
Dataset
|
Atmosphere thermophysical profile dataset. |
Source code in src/joseki/profiles/afgl_1986.py
joseki.profiles.mipas_2007
¶
MIPAS atmosphere thermophysical profiles.
Remedios et al. (2007) define a set of 5 "standard atmospheres" representing the atmosphere at different latitudes and seasons or times of day:
- midlatitude day
- midlatitude night
- polar winter
- polar summer
- tropical
MIPAS standard atmospheres were intended to provide an updated set of pro- files for characteristic atmospheric states such as the AFGL Atmospheric constituent profiles.
joseki.profiles.mipas_2007.Identifier
¶
Bases: Enum
MIPAS atmosphere thermophysical profile identifier enumeration.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.MIPASMidlatitudeDay
¶
Bases: Profile
MIPAS midlatitude day reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.MIPASMidlatitudeNight
¶
Bases: Profile
MIPAS Midlatitude night reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.MIPASPolarSummer
¶
Bases: Profile
MIPAS Polar summer reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.MIPASPolarWinter
¶
Bases: Profile
MIPAS Polar winter reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.MIPASTropical
¶
Bases: Profile
MIPAS Tropical reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.get_dataset(identifier)
¶
Read MIPAS reference atmosphere data files into an xarray.Dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
Identifier
|
Atmospheric profile identifier.
See
|
required |
Returns:
Type | Description |
---|---|
Dataset
|
Atmospheric profile. |
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.parse_content(lines)
¶
Parse lines.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.parse_units(s)
¶
Parse units.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.parse_values_line(s)
¶
Parse a line with numeric values.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.parse_var_line(s)
¶
Parse a line with the declaration of a variable and its units.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.parse_var_name(n)
¶
joseki.profiles.mipas_2007.read_file_content(identifier)
¶
Read data file content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
Identifier
|
Atmospheric profile identifier.
See
|
required |
Returns:
Type | Description |
---|---|
str
|
file content, URL, URL date. |
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.to_chemical_formula(name)
¶
Convert to chemical formula.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Molecule name. |
required |
Returns:
Type | Description |
---|---|
str
|
Molecule formula. |
Notes
If molecule name is unknown, returns name unchanged.
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.to_dataset(identifier, z=None, method=None, conserve_column=False, **kwargs)
¶
Helper for Profile.to_dataset
method
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.mipas_2007.translate_cfc(name)
¶
Convert chlorofulorocarbon name to corresponding chemical formula.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Chlorofulorocarbon name. |
required |
Returns:
Type | Description |
---|---|
str
|
Chlorofulorocarbon chemical formula. |
Raises:
Type | Description |
---|---|
ValueError
|
If the name does not match a known chlorofulorocarbon. |
Source code in src/joseki/profiles/mipas_2007.py
joseki.profiles.ussa_1976
¶
Module to compute the U.S. Standard Atmosphere 1976.
The U.S. Standard Atmosphere 1976 is a Earth atmosphere thermophysical model described in the technical report NOAA+1976.
joseki.profiles.ussa_1976.USSA1976
¶
Bases: Profile
Class to compute the U.S. Standard Atmosphere 1976.
The U.S. Standard Atmosphere 1976 is a Earth atmosphere thermophysical model described in the technical report NOAA+1976.
Source code in src/joseki/profiles/ussa_1976.py
joseki.profiles.util
¶
Utility module.
joseki.profiles.util.air_molar_mass_from_mass_fraction(y)
¶
Compute the air molar mass from the of air constituents mass fractions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
DataArray
|
Mass fraction as a function of molecule ( |
required |
Returns:
Type | Description |
---|---|
DataArray
|
Air molar mass as a function of altitude ( |
Notes
The air molar mass is computed according to the following equation:
where:
- \(y_{\mathrm{M}} (z)\) is the mass fraction of molecule M at altitude \(z\),
- \(m_{\mathrm{M}}\) is the molar mass of molecule M.
Source code in src/joseki/profiles/util.py
joseki.profiles.util.number_density(p, t)
¶
Compute air number density from air pressure and air temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p |
Quantity
|
Air pressure. |
required |
t |
Quantity
|
Air temperature. |
required |
Returns:
Type | Description |
---|---|
Quantity
|
Number density. |
Notes
The air number density is computed according to the ideal gas law:
where \(p\) is the air pressure, \(k_B\) is the Boltzmann constant, and \(T\) is the air temperature.
Source code in src/joseki/profiles/util.py
joseki.profiles.util.utcnow()
¶
Get current UTC time.
Returns:
Type | Description |
---|---|
str
|
ISO 8601 formatted UTC timestamp. |
joseki.core
¶
Core module.
joseki.core.identifiers()
¶
List all registered profile identifiers.
Returns:
Type | Description |
---|---|
List[str]
|
List of all registered profile identifiers. |
joseki.core.load_dataset(path, *args, **kwargs)
¶
Thin wrapper around xarray.load_dataset
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
PathLike
|
Path to the dataset. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Profile. |
joseki.core.make(identifier, z=None, interp_method=DEFAULT_METHOD, conserve_column=False, molecules=None, regularize=None, rescale_to=None, check_x_sum=False, **kwargs)
¶
Create a profile with the specified identifier.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Profile identifier. |
required |
z |
Quantity | dict | DataArray | None
|
Altitude values. |
None
|
interp_method |
Mapping[str, str] | None
|
Mapping of variable and interpolation method. |
DEFAULT_METHOD
|
conserve_column |
bool
|
If |
False
|
molecules |
List[str] | None
|
List of molecules to include in the profile. |
None
|
regularize |
bool | dict | None
|
Regularize the altitude grid with specified options which are passed to regularize. |
None
|
rescale_to |
dict | None
|
Rescale molecular concentrations to the specified target values which are passed to rescale_to. |
None
|
check_x_sum |
bool
|
If |
False
|
kwargs |
Any
|
Additional keyword arguments passed to the profile constructor. |
{}
|
Returns:
Type | Description |
---|---|
Dataset
|
Profile as xarray.Dataset. |
See Also
Source code in src/joseki/core.py
joseki.core.merge(datasets, new_title=None)
¶
Merge multiple profiles into a single profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datasets |
Iterable[Dataset]
|
Iterable of profiles. |
required |
new_title |
str | None
|
New title for the merged profile. If |
None
|
Returns:
Type | Description |
---|---|
Dataset
|
Merged profile. |
Notes
The first profile in the iterable is used as the base profile; when variables with the same name are encountered in subsequent profiles, the variable from the first profile is used.
Source code in src/joseki/core.py
joseki.core.open_dataset(path, *args, **kwargs)
¶
Thin wrapper around xarray.open_dataset
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
PathLike
|
Path to the dataset. |
required |
Returns:
Type | Description |
---|---|
Dataset
|
Profile. |
joseki.units
¶
Units module.
joseki.units.to_quantity(value, units=None)
¶
Convert to a pint.Quantity
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
Quantity | dict | int | float | list | ndarray | DataArray
|
Value which will be converted. If value is an |
required |
units |
None | str
|
Units to assign. If |
None
|
Returns:
Type | Description |
---|---|
Quantity
|
The corresponding quantity. |
Notes
This function can also be used on DataArray and Dataset coordinate variables.
Source code in src/joseki/units.py
joseki.profiles.util
¶
Utility module.
joseki.profiles.util.air_molar_mass_from_mass_fraction(y)
¶
Compute the air molar mass from the of air constituents mass fractions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
DataArray
|
Mass fraction as a function of molecule ( |
required |
Returns:
Type | Description |
---|---|
DataArray
|
Air molar mass as a function of altitude ( |
Notes
The air molar mass is computed according to the following equation:
where:
- \(y_{\mathrm{M}} (z)\) is the mass fraction of molecule M at altitude \(z\),
- \(m_{\mathrm{M}}\) is the molar mass of molecule M.
Source code in src/joseki/profiles/util.py
joseki.profiles.util.number_density(p, t)
¶
Compute air number density from air pressure and air temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p |
Quantity
|
Air pressure. |
required |
t |
Quantity
|
Air temperature. |
required |
Returns:
Type | Description |
---|---|
Quantity
|
Number density. |
Notes
The air number density is computed according to the ideal gas law:
where \(p\) is the air pressure, \(k_B\) is the Boltzmann constant, and \(T\) is the air temperature.
Source code in src/joseki/profiles/util.py
joseki.profiles.util.utcnow()
¶
Get current UTC time.
Returns:
Type | Description |
---|---|
str
|
ISO 8601 formatted UTC timestamp. |