Siphon - A collection of Python utilities for retrieving data from Unidata data technologies.
Index(['lvltyp1', 'lvltyp2', 'etime', 'pressure', 'pflag', 'height', 'zflag',
'temperature', 'tflag', 'relative_humidity', 'direction', 'speed',
'date', 'u_wind', 'v_wind', 'dewpoint'],
dtype='object')
0 925.0
1 850.0
2 700.0
3 NaN
4 NaN
5 NaN
6 NaN
7 NaN
8 NaN
9 NaN
10 NaN
11 NaN
12 NaN
13 NaN
14 NaN
Name: pressure, dtype: float64
{'etime': 'second', 'pressure': 'hPa', 'height': 'meter', 'temperature': 'degC', 'dewpoint': 'degC', 'direction': 'degrees', 'speed': 'meter / second', 'u_wind': 'meter / second', 'v_wind': 'meter / second'}
hPa
[nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan] degree_Celsius
[nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan] degree_Celsius
[0.4 2.4 4.1 -0.0 0.4 0.7 3.4 3.3 3.5 1.7 6.2 8.7 4.7 5.4 9.5] meter / second
[344.05460409907715 294.6235647861636 335.2656974709475 0.0 349.2157021324374 315.0 305.2175929681927 324.9262455066517 340.15930191603167 350.059426966887 329.91031376122334 315.0 315.0 315.0 315.0] degree
Traceback (most recent call last):
File "igra_sounds.py", line 102, in <module>
lcl_pressure, lcl_temperature = mpcalc.lcl(p[0], T[0], Td[0])
File "/usr/local/lib/python3.8/dist-packages/metpy/xarray.py", line 677, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/metpy/units.py", line 320, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python3.8/dist-packages/metpy/calc/thermo.py", line 357, in lcl
lcl_p = so.fixed_point(_lcl_iter, pressure.m, args=(pressure.m, w, temperature),
File "/usr/local/lib/python3.8/dist-packages/scipy-1.5.2-py3.8-linux-x86_64.egg/scipy/optimize/minpack.py", line 937, in fixed_point
return _fixed_point_helper(func, x0, args, xtol, maxiter, use_accel)
File "/usr/local/lib/python3.8/dist-packages/scipy-1.5.2-py3.8-linux-x86_64.egg/scipy/optimize/minpack.py", line 891, in _fixed_point_helper
raise RuntimeError(msg)
RuntimeError: Failed to converge after 50 iterations, value is nan
-9999
), which get translated to nans. Siphon's not doing anything wrong in this case, that's an issue with the underlying data, nothing we can do about. If you encounter any additional data oddities in the future, my recommendation would be to first try to download the data manually and see if what Siphon is giving you matches up with what's in the raw data file.
CDMRemote
(which siphon supports using with xarray)
Is anyone having problems pulling netCDF subsets from NCEI using TDSCatalogs? I've been trying to update some old codes that used siphon and have been looking at the Unidata python training to help but it seems like I keep getting hung up on either one of theses lines : data = ncss.get_data(query)
or
ncss = cat.datasets[f'gfsanl_4_{dt:%Y%m%d}_{dt:%H}00_000.grb2'].subset()
which gives me error messages of:
HTTPError: Error accessing https://www.ncei.noaa.gov/thredds/ncss/model-gfs-g4-anl-files-old/201801/20180104/gfsanl_4_20180104_1200_000.grb2?var=Apparent_temperature_height_above_ground&var=Pressure_reduced_to_MSL_msl&var=v-component_of_wind_height_above_ground&var=u-component_of_wind_height_above_ground&time=2018-01-04T12%3A00%3A00&accept=netcdf
Server Error (500: java.lang.IllegalStateException: No records found in dataset gfsanl_4_20180104_1200_000.grb2)
and
HTTPError: Error accessing https://www.ncei.noaa.gov/thredds/ncss/model-gfs-g4-anl-files-old/201801/20180104/gfsanl_4_20180104_1200_000.grb2/dataset.xml
Server Error (500: java.lang.IllegalStateException: No records found in dataset gfsanl_4_20180104_1200_000.grb2)
I'm running this in jupyter notebooks, so once I get the first error if I don't restart I get the second error.
Also, if you click the link in the first error message it will download the netCDF subset that you were requesting.
I can't get the python logger to print to either a file or screen when using TDSCatalog. Is there an alternate way to create messages for debugging in siphon? For Example:
import logging
from siphon.catalog import TDSCatalog
FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
logging.basicConfig(format=FORMAT)
logger = logging.getLogger(__name__)
logger.warning("Test This")
Does not work when the siphon import is being used.