Reference
This reference manual details functions, modules, and objects included in
joseki
, describing what they are and what they do.
Accessor¶
Accessor module.
JosekiAccessor
¶
Joseki accessor.
Source code in src/joseki/accessor.py
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 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 477 478 479 480 |
|
air_molar_mass: xr.DataArray
property
¶
Compute air molar mass as a function of altitude.
Returns:
Type | Description |
---|---|
xr.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.
column_mass_density: t.Dict[str, pint.Quantity]
property
¶
Compute column mass density.
Returns:
Type | Description |
---|---|
t.Dict[str, pint.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.
column_number_density: t.Dict[str, pint.Quantity]
property
¶
Compute column number density.
Returns:
Type | Description |
---|---|
t.Dict[str, pint.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.
mass_density_at_sea_level: t.Dict[str, pint.Quantity]
property
¶
Compute mass density at sea level.
Returns:
Type | Description |
---|---|
t.Dict[str, pint.Quantity]
|
A mapping of molecule and mass density at sea level. |
mass_fraction: xr.DataArray
property
¶
Extract mass fraction and tabulate as a function of (m, z).
Returns:
Type | Description |
---|---|
xr.DataArray
|
Mass fraction. |
mole_fraction: xr.DataArray
property
¶
Extract mole fraction and tabulate as a function of (m, z).
Returns:
Type | Description |
---|---|
xr.DataArray
|
Mole fraction. |
mole_fraction_at_sea_level: t.Dict[str, pint.Quantity]
property
¶
Compute mole fraction at sea level.
Returns:
Type | Description |
---|---|
t.Dict[str, pint.Quantity]
|
A mapping of molecule and mole fraction at sea level. |
molecules: t.List[str]
property
¶
Return list of molecules.
number_density_at_sea_level: t.Dict[str, pint.Quantity]
property
¶
Compute number density at sea level.
Returns:
Type | Description |
---|---|
t.Dict[str, pint.Quantity]
|
A mapping of molecule and number density at sea level. |
drop_molecules(molecules)
¶
Drop molecules from dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
molecules |
t.List[str]
|
List of molecules to drop. |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Dataset with molecules dropped. |
Source code in src/joseki/accessor.py
rescale(factors, check_x_sum=False)
¶
Rescale molecules concentration in atmospheric profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factors |
t.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:
Type | Description |
---|---|
ValueError
|
if |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Rescaled dataset (new object). |
Source code in src/joseki/accessor.py
rescale_to(target, check_x_sum=False)
¶
Rescale mole fractions to match target molecular total column densities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
t.Mapping[str, pint.Quantity | dict | xr.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 |
---|---|
xr.Dataset
|
Rescaled dataset (new object). |
Source code in src/joseki/accessor.py
scaling_factors(target)
¶
Compute scaling factor(s) to reach specific target amount(s).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target |
t.MutableMapping[str, pint.Quantity | dict | xr.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 |
---|---|
t.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
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
molecular_mass(m)
¶
Return the average molecular mass of a molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
m |
str
|
Molecule formula. |
required |
Returns:
Type | Description |
---|---|
pint.Quantity
|
Average molecular mass. |
Data¶
Profiles¶
Factory¶
Profile factory module.
ProfileFactory
¶
Profile factory class.
Source code in src/joseki/profiles/factory.py
registered_identifiers: t.List[str]
property
¶
Registered profile identifiers.
Returns:
Type | Description |
---|---|
t.List[str]
|
List of registered profile identifiers. |
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
register(identifier)
¶
Register a profile class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier |
str
|
Profile identifier. |
required |
Returns:
Type | Description |
---|---|
t.Callable
|
Decorator function. |
Source code in src/joseki/profiles/factory.py
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.
Profile
¶
Bases: ABC
Abstract class for atmosphere thermophysical profiles.
Source code in src/joseki/profiles/core.py
to_dataset(z=None, interp_method=None, conserve_column=False, **kwargs)
abstractmethod
¶
Return the profile as a dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
z |
t.Optional[pint.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 |
t.Optional[t.Mapping[str, str]]
|
Interpolation method for each variable.
If |
None
|
conserve_column |
bool
|
If |
False
|
kwargs |
t.Any
|
Parameters passed to lower-level methods. |
{}
|
Returns:
Type | Description |
---|---|
xr.Dataset
|
Atmospheric profile. |
Source code in src/joseki/profiles/core.py
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 |
xr.Dataset
|
Initial atmospheric profile. |
required |
z_extra |
pint.Quantity
|
Altitude(s) to extrapolate to. |
required |
direction |
str
|
Direction of the extrapolation, either "up" or "down". |
required |
method |
t.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 |
---|---|
xr.Dataset
|
Extrapolated atmospheric profile. |
Source code in src/joseki/profiles/core.py
interp(ds, z_new, method=DEFAULT_METHOD, conserve_column=False, **kwargs)
¶
Interpolate atmospheric profile on new altitudes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
xr.Dataset
|
Atmospheric profile to interpolate. |
required |
z_new |
pint.Quantity
|
Altitudes values at which to interpolate the atmospheric profile. |
required |
method |
t.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 |
t.Any
|
Parameters passed to |
{}
|
Returns:
Type | Description |
---|---|
xr.Dataset
|
Interpolated atmospheric profile. |
Source code in src/joseki/profiles/core.py
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 |
|
regularize(ds, method=DEFAULT_METHOD, conserve_column=False, options=DEFAULT_OPTIONS, **kwargs)
¶
Regularize the profile's altitude grid.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
xr.Dataset
|
Initial atmospheric profile. |
required |
method |
t.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 |
t.Dict[str, t.Union[int, str, pint.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 |
t.Any
|
Keyword arguments passed to the interpolation function. |
{}
|
Returns:
Type | Description |
---|---|
xr.Dataset
|
Regularized atmospheric profile. |
Source code in src/joseki/profiles/core.py
rescale_to_column(reference, ds)
¶
Rescale mole fraction to ensure that column densities are conserved.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reference |
xr.Dataset
|
Reference profile. |
required |
ds |
xr.Dataset
|
Profile to rescale. |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Rescaled profile. |
Source code in src/joseki/profiles/core.py
select_molecules(ds, molecules)
¶
Select specified molecules in the profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
xr.Dataset
|
Initial atmospheric profile. |
required |
molecules |
t.List[str]
|
List of molecules to select. |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Atmospheric profile with exactly the specified molecules. |
Source code in src/joseki/profiles/core.py
Dataset 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.
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 |
|
convert(data_vars, coords, attrs)
¶
Convert input to schema-compliant dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_vars |
t.Mapping[str, pint.Quantity]
|
Mapping of data variable names to quantities. |
required |
coords |
t.Mapping[str, pint.Quantity]
|
Mapping of coordinate names to quantities. |
required |
attrs |
t.Mapping[str, str]
|
Mapping of attribute names to values. |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Dataset with schema-compliant data variables, coordinates, and |
xr.Dataset
|
attributes. |
Source code in src/joseki/profiles/schema.py
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 |
|
validate(ds, check_x_sum=False, ret_true_if_valid=False)
¶
Validate dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
xr.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. |
False
|
Raises:
Type | Description |
---|---|
ValueError
|
If the dataset does not match the schema. |
Returns:
Type | Description |
---|---|
t.Optional[bool]
|
None or bool: If |
Source code in src/joseki/profiles/schema.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 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 |
|
mole_fraction_sum(ds)
¶
Compute the sum of mole fractions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ds |
xr.Dataset
|
Dataset. |
required |
Returns:
Type | Description |
---|---|
pint.Quantity
|
The sum of mole fractions. |
Source code in src/joseki/profiles/schema.py
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.
AFGL1986MidlatitudeSummer
¶
Bases: Profile
AFGL 1986 midlatitude summer atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
AFGL1986MidlatitudeWinter
¶
Bases: Profile
AFGL 1986 midlatitude winter atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
AFGL1986SubarcticSummer
¶
Bases: Profile
AFGL 1986 subarctic summer atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
AFGL1986SubarcticWinter
¶
Bases: Profile
AFGL 1986 subarctic winter atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
AFGL1986Tropical
¶
Bases: Profile
AFGL 1986 tropical atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
AFGL1986USStandard
¶
Bases: Profile
AFGL 1986 US Standard atmosphere thermophysical profile.
Source code in src/joseki/profiles/afgl_1986.py
Identifier
¶
Bases: enum.Enum
AFGL 1986 atmospheric profile identifier enumeration.
Source code in src/joseki/profiles/afgl_1986.py
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 |
pd.DataFrame
|
Atmospheric profile data. |
required |
identifier |
Identifier
|
Atmospheric profile identifier. |
required |
additional_molecules |
bool
|
If |
True
|
Returns:
Type | Description |
---|---|
xr.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
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 |
---|---|
xr.Dataset
|
Atmospheric profile dataset. |
Notes
Chain calls to
parse
and
dataframe_to_dataset
.
Source code in src/joseki/profiles/afgl_1986.py
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 |
---|---|
pd.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
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 |
t.Optional[pint.Quantity]
|
New level altitudes.
If |
None
|
interp_method |
t.Mapping[str, str]
|
Interpolation method for each data variable. Default is
|
None
|
conserve_column |
bool
|
If |
False
|
kwargs |
t.Any
|
Additional arguments passed to
|
{}
|
Returns:
Type | Description |
---|---|
xr.Dataset
|
Atmosphere thermophysical profile dataset. |
Source code in src/joseki/profiles/afgl_1986.py
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.
Identifier
¶
Bases: enum.Enum
MIPAS atmosphere thermophysical profile identifier enumeration.
Source code in src/joseki/profiles/mipas_2007.py
MIPASMidlatitudeDay
¶
Bases: Profile
MIPAS midlatitude day reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
MIPASMidlatitudeNight
¶
Bases: Profile
MIPAS Midlatitude night reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
MIPASPolarSummer
¶
Bases: Profile
MIPAS Polar summer reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
MIPASPolarWinter
¶
Bases: Profile
MIPAS Polar winter reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
MIPASTropical
¶
Bases: Profile
MIPAS Tropical reference atmosphere.
Source code in src/joseki/profiles/mipas_2007.py
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 |
---|---|
xr.Dataset
|
Atmospheric profile. |
Source code in src/joseki/profiles/mipas_2007.py
parse_content(lines)
¶
Parse lines.
Source code in src/joseki/profiles/mipas_2007.py
parse_units(s)
¶
Parse units.
Source code in src/joseki/profiles/mipas_2007.py
parse_values_line(s)
¶
Parse a line with numeric values.
Source code in src/joseki/profiles/mipas_2007.py
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
parse_var_name(n)
¶
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
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
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
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
US Standard Atmosphere (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.
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
Utilities¶
Utility module.
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 |
xr.DataArray
|
Mass fraction as a function of molecule ( |
required |
Returns:
Type | Description |
---|---|
xr.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
mass_fraction_to_mole_fraction3(y, m_air=28.9644 * ureg.g / ureg.mole)
¶
Convert mass fractions to mole fractions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
xr.DataArray
|
Mass fraction as a function of molecule ( |
required |
m_air |
pint.Quantity
|
Molar mass of air. Defaults to 28.9644 g/mol. |
28.9644 * ureg.g / ureg.mole
|
Returns:
Type | Description |
---|---|
xr.DataArray
|
Volume fraction as a function of molecule ( |
Notes
The mole fraction of molecule M at altitude \(z\) 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\),
- \(m_{\mathrm{air}}\) is the air molar mass (
m_air
).
Source code in src/joseki/profiles/util.py
number_density(p, t)
¶
Compute air number density from air pressure and air temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p |
pint.Quantity
|
Air pressure. |
required |
t |
pint.Quantity
|
Air temperature. |
required |
Returns:
Type | Description |
---|---|
pint.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
to_m_suffixed_data(da)
¶
Takes a data array with a m
coordinate and returns a dataset with
a data variable for each molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
da |
xr.DataArray
|
Data array with a |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Dataset with a data variable for each molecule. |
Source code in src/joseki/profiles/util.py
utcnow()
¶
Get current UTC time.
Returns:
Type | Description |
---|---|
str
|
ISO 8601 formatted UTC timestamp. |
Command line interface¶
Command-line interface.
main(file_name, identifier, altitudes, altitude_units, conserve_column, p_interp_method, t_interp_method, n_interp_method, x_interp_method)
¶
Joseki command-line interface.
Source code in src/joseki/__main__.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 |
|
Core¶
Core module.
identifiers()
¶
List all registered profile identifiers.
Returns:
Type | Description |
---|---|
t.List[str]
|
List of all registered profile identifiers. |
load_dataset(path, *args, **kwargs)
¶
Thin wrapper around xarray.load_dataset
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
os.PathLike
|
Path to the dataset. |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Profile. |
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 |
pint.Quantity | dict | xr.DataArray | None
|
Altitude values. |
None
|
interp_method |
t.Mapping[str, str] | None
|
Mapping of variable and interpolation method. |
DEFAULT_METHOD
|
conserve_column |
bool
|
If |
False
|
molecules |
t.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 |
t.Any
|
Additional keyword arguments passed to the profile constructor. |
{}
|
Returns:
Type | Description |
---|---|
xr.Dataset
|
Profile as xarray.Dataset. |
See Also
Source code in src/joseki/core.py
merge(datasets, new_title=None)
¶
Merge multiple profiles into a single profile.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datasets |
t.Iterable[xr.Dataset]
|
Iterable of profiles. |
required |
new_title |
str | None
|
New title for the merged profile. If |
None
|
Returns:
Type | Description |
---|---|
xr.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
open_dataset(path, *args, **kwargs)
¶
Thin wrapper around xarray.open_dataset
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
os.PathLike
|
Path to the dataset. |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Profile. |
Units¶
Units module.
to_quantity(value, units=None)
¶
Convert to a pint.Quantity
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value |
pint.Quantity | dict | int | float | list | np.ndarray | xr.DataArray
|
Value which will be converted. If value is an |
required |
units |
None | str
|
Units to assign. If |
None
|
Returns:
Type | Description |
---|---|
pint.Quantity
|
The corresponding quantity. |
Notes
This function can also be used on DataArray and Dataset coordinate variables.
Source code in src/joseki/units.py
Util¶
Utility module.
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 |
xr.DataArray
|
Mass fraction as a function of molecule ( |
required |
Returns:
Type | Description |
---|---|
xr.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
mass_fraction_to_mole_fraction3(y, m_air=28.9644 * ureg.g / ureg.mole)
¶
Convert mass fractions to mole fractions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y |
xr.DataArray
|
Mass fraction as a function of molecule ( |
required |
m_air |
pint.Quantity
|
Molar mass of air. Defaults to 28.9644 g/mol. |
28.9644 * ureg.g / ureg.mole
|
Returns:
Type | Description |
---|---|
xr.DataArray
|
Volume fraction as a function of molecule ( |
Notes
The mole fraction of molecule M at altitude \(z\) 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\),
- \(m_{\mathrm{air}}\) is the air molar mass (
m_air
).
Source code in src/joseki/profiles/util.py
number_density(p, t)
¶
Compute air number density from air pressure and air temperature.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p |
pint.Quantity
|
Air pressure. |
required |
t |
pint.Quantity
|
Air temperature. |
required |
Returns:
Type | Description |
---|---|
pint.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
to_m_suffixed_data(da)
¶
Takes a data array with a m
coordinate and returns a dataset with
a data variable for each molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
da |
xr.DataArray
|
Data array with a |
required |
Returns:
Type | Description |
---|---|
xr.Dataset
|
Dataset with a data variable for each molecule. |
Source code in src/joseki/profiles/util.py
utcnow()
¶
Get current UTC time.
Returns:
Type | Description |
---|---|
str
|
ISO 8601 formatted UTC timestamp. |