@@ -90,24 +90,24 @@ def fCO2_to_CO2aq(fCO2, k_CO2):
90
90
return fCO2 * k_CO2
91
91
92
92
93
- def celsius_to_kelvin (TempC ):
93
+ def celsius_to_kelvin (temperature ):
94
94
"""Convert temperature from degC to K."""
95
- return TempC + constants .Tzero
95
+ return temperature + constants .Tzero
96
96
97
97
98
- def kelvin_to_celsius (TempK ):
98
+ def kelvin_to_celsius (temperature_K ):
99
99
"""Convert temperature from K to degC."""
100
- return TempK - constants .Tzero
100
+ return temperature_K - constants .Tzero
101
101
102
102
103
- def decibar_to_bar (Pdbar ):
103
+ def decibar_to_bar (pressure ):
104
104
"""Convert pressure from dbar to bar."""
105
- return Pdbar / 10.0
105
+ return pressure / 10.0
106
106
107
107
108
- def bar_to_decibar (Pbar ):
108
+ def bar_to_decibar (pressure_bar ):
109
109
"""Convert pressure from bar to dbar."""
110
- return Pbar * 10.0
110
+ return pressure_bar * 10.0
111
111
112
112
113
113
def pH_free_to_tot (total_sulfate , k_HSO4_free ):
@@ -421,52 +421,6 @@ def pH_sws_to_tot_P0(TempK, totals, k_constants, WhoseKSO4, WhoseKF):
421
421
return pH_sws_to_tot (totals , k_constants_P0 )
422
422
423
423
424
- def get_pHfactor_from_SWS (TempK , Sal , totals , k_constants , pHScale , WhichKs ):
425
- """Determine pH scale conversion factors to go from SWS to input pHScale(s).
426
- The raw K values (not pK) should be multiplied by these to make the conversion.
427
- """
428
- if "fH" not in k_constants :
429
- k_constants ["fH" ] = pressured .fH (TempK , Sal , WhichKs )
430
- pHfactor = np .full (np .shape (pHScale ), np .nan )
431
- pHfactor = np .where (
432
- pHScale == 1 , pH_sws_to_tot (totals , k_constants ), pHfactor
433
- ) # Total
434
- pHfactor = np .where (pHScale == 2 , 1.0 , pHfactor ) # Seawater (SWS)
435
- pHfactor = np .where (
436
- pHScale == 3 ,
437
- pH_sws_to_free (total_fluoride , total_sulfate , k_HF_free , k_HSO4_free ),
438
- pHfactor ,
439
- ) # Free
440
- pHfactor = np .where (
441
- pHScale == 4 , pH_sws_to_nbs (totals , k_constants ), pHfactor
442
- ) # NBS
443
- k_constants ["pHfactor_from_SWS" ] = pHfactor
444
- return k_constants
445
-
446
-
447
- def get_pHfactor_to_Free (TempK , Sal , totals , k_constants , pHScale , WhichKs ):
448
- """Determine pH scale conversion factors to go from input pHScale(s) to Free.
449
- The raw K values (not pK) should be multiplied by these to make the conversion.
450
- """
451
- if "fH" not in k_constants :
452
- k_constants ["fH" ] = pressured .fH (TempK , Sal , WhichKs )
453
- pHfactor = np .full (np .shape (pHScale ), np .nan )
454
- pHfactor = np .where (
455
- pHScale == 1 , pH_tot_to_free (totals , k_constants ), pHfactor
456
- ) # Total
457
- pHfactor = np .where (
458
- pHScale == 2 ,
459
- pH_sws_to_free (total_fluoride , total_sulfate , k_HF_free , k_HSO4_free ),
460
- pHfactor ,
461
- ) # Seawater (SWS)
462
- pHfactor = np .where (pHScale == 3 , 1.0 , pHfactor ) # Free
463
- pHfactor = np .where (
464
- pHScale == 4 , pH_nbs_to_free (totals , k_constants ), pHfactor
465
- ) # NBS
466
- k_constants ["pHfactor_to_Free" ] = pHfactor
467
- return k_constants
468
-
469
-
470
424
def options_old2new (KSO4CONSTANTS ):
471
425
"""Convert traditional CO2SYS `KSO4CONSTANTS` input to new separated format."""
472
426
if np .shape (KSO4CONSTANTS ) == ():
@@ -509,33 +463,6 @@ def _flattenfirst(args, dtype):
509
463
)
510
464
511
465
512
- def _flattenafter (args , npts , dtype ):
513
- # Determine and check lengths of input vectors
514
- arglengths = np .array ([np .size (arg ) for arg in args ])
515
- assert np .all (
516
- np .isin (arglengths , [1 , npts ])
517
- ), "Inputs must all be the same length as each other or of length 1."
518
- # Make vectors of all inputs
519
- return [
520
- (
521
- np .full (npts , arg , dtype = dtype )
522
- if np .size (arg ) == 1
523
- else arg .ravel ().astype (dtype )
524
- )
525
- for arg in args
526
- ]
527
-
528
-
529
- def _flattentext (args , npts ):
530
- # Determine and check lengths of input vectors
531
- arglengths = np .array ([np .size (arg ) for arg in args ])
532
- assert np .all (
533
- np .isin (arglengths , [1 , npts ])
534
- ), "Inputs must all be the same length as each other or of length 1."
535
- # Make vectors of all inputs
536
- return [np .full (npts , arg ) if np .size (arg ) == 1 else arg .ravel () for arg in args ]
537
-
538
-
539
466
def options_new2old (KSO4CONSTANT , BORON ):
540
467
"""Convert separated `KSO4CONSTANT` and `BORON` options into traditional CO2SYS
541
468
`KSO4CONSTANTS` input.
0 commit comments