3. Accessing Site Data¶
In order to model the PWV absorption for a given date and time, GPS
measurements for that date must be available on your local machine. Accessing
and downloading new GPS data is handled by the pwv_atm
module.
3.1. Checking For Available Data¶
To check what years of data have been downloaded from the SuomiNet server, use the
downloaded_years
function.
-
pwv_kpno.pwv_atm.
downloaded_years
()[source]¶ Return a list of years for which SuomiNet data has been downloaded
Return a list of years for which SuomiNet data has been downloaded to the local machine. Note that this list includes years for which any amount of data has been downloaded. It does not indicate if additional data has been released by SuomiNet for a given year that is not locally available.
Returns: A list of years with locally available SuomiNet data
By default, each release of pwv_kpno contains all necessary SuomiNet data from 2010 through the end of the previous year.
1 2 3 4 | >>> from pwv_kpno import pwv_atm
>>> pwv_atm.downloaded_years()
[2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017]
|
3.2. Updating Data¶
To download new data to your local machine, use the update_models
function. This function will download new data from the SuomiNet web server,
and use that data to update the modeled precipitable water vapor for the
current site being modeled.
-
pwv_kpno.pwv_atm.
update_models
(years=None, timeout=None)[source]¶ Download data from SuomiNet and update the locally stored PWV model
Update the modeled PWV column density for the current site by downloading new data releases from the SuomiNet website. Suominet organizes its data by year. If the years argument is not provided, download any missing data from the earliest available date on the current machine through the present day.
Parameters: - years (list) – A list of integer years to download
- timeout (float) – Optional seconds to wait while connecting to SuomiNet
Returns: A list of years for which models where updated
To ensure that the PWV data for pwv_kpno is up to date run:
1 2 3 4 5 6 7 8 9 10 11 | >>> from pwv_kpno import pwv_atm
>>>
>>> # Download any new / missing data
>>> pwv_atm.update_models()
[2017, 2018]
>>> # Re-download a specific year
>>> pwv_atm.update_models([2010])
[2010]
|
Note
If pwv_kpno has been set to model a custom site and no data has already been downloaded from SuomiNet, this function will default to download any available data from 2010 onward.
3.3. Measured PWV Data¶
Any locally available PWV data for the current site being modeled can be
accessed using the measured_pwv
function.
-
pwv_kpno.pwv_atm.
measured_pwv
(year=None, month=None, day=None, hour=None)[source]¶ Return an astropy table of PWV measurements taken by SuomiNet
Columns are named using the SuomiNet IDs for different GPS receivers. PWV measurements for each receiver are recorded in millimeters. Results can be optionally refined by year, month, day, and hour.
Parameters: - year (int) – The year of the desired PWV data
- month (int) – The month of the desired PWV data
- day (int) – The day of the desired PWV data
- hour (int) – The hour of the desired PWV data in 24-hour format
Returns: An astropy table of measured PWV values in mm
To retrieve all SuomiNet data available on the local machine:
1 2 3 4 5 6 7 8 9 10 | >>> from pwv_kpno import pwv_atm
>>> pwv_atm.measured_pwv()
date KITT KITT_err P014 P014_err SA46 SA46_err SA48 ...
UTC mm mm mm mm mm mm mm ...
------------------- ---- -------- ---- -------- ---- -------- ---- ...
2010-01-01 00:15:00 -- -- 3.6 0.125 4.2 0.125 4.7 ...
2010-01-01 00:45:00 -- -- 3.7 0.125 4.0 0.125 4.7 ...
2010-01-01 01:15:00 -- -- 3.7 0.025 3.4 0.125 3.6 ...
... ... ... ... ... ... ... ... ...
|
To retrieve SuomiNet data taken on a specific date or time:
1 2 3 4 5 6 7 8 9 | >>> pwv_atm.measured_pwv(year=2016, month=11, day=14)
date KITT KITT_err P014 P014_err SA46 SA46_err SA48 ...
UTC mm mm mm mm mm mm mm ...
------------------- ---- -------- ---- -------- ---- -------- ---- ...
2016-11-14 00:15:00 4.7 1.025 6.9 0.525 9.8 0.725 -- ...
2016-11-14 00:45:00 4.3 1.025 6.7 0.425 9.9 0.525 -- ...
2016-11-14 01:15:00 3.9 0.925 6.7 0.425 9.7 0.525 -- ...
... ... ... ... ... ... ... ... ...
|
Note
If no SuomiNet data is available at all during the specified datetime, then the returned table will be empty.
3.4. Modeled PWV Data¶
To retrieve the modeled PWV level for the site’s primary GPS receiver, use the
modeled_pwv
function.
-
pwv_kpno.pwv_atm.
modeled_pwv
(year=None, month=None, day=None, hour=None)[source]¶ Return a table of the modeled PWV at the current site being modeled
Return a model for the precipitable water vapor level at the current site as an astropy table. PWV measurements are reported in units of millimeters. Results can be optionally refined by year, month, day, and hour.
Parameters: - year (int) – The year of the desired PWV data
- month (int) – The month of the desired PWV data
- day (int) – The day of the desired PWV data
- hour (int) – The hour of the desired PWV data in 24-hour format
Returns: An astropy table of modeled PWV values in mm
To retrieve the entire PWV model for all available dates:
>>> from pwv_kpno import pwv_atm
>>> pwv_atm.modeled_pwv()
date pwv pwv_err
UTC mm mm
------------------- ----- -------
2010-01-01 00:15:00 1.55 1.227
2010-01-01 00:45:00 1.532 1.225
2010-01-01 01:15:00 1.178 1.175
... ... ...
To retrieve the modeled PWV level for a specific date or time:
>>> pwv_atm.modeled_pwv(year=2016, month=11, day=14)
date pwv pwv_err
UTC mm mm
------------------- --- -------
2016-11-14 00:15:00 4.7 1.025
2016-11-14 00:45:00 4.3 1.025
2016-11-14 01:15:00 3.9 0.925
... ... ...
3.5. PWV For a Given Date¶
For convenience, users can interpolate from the modeled PWV concentration at
Kitt Peak using the pwv_date
function.
-
pwv_kpno.pwv_atm.
pwv_date
(date, airmass=1.0)[source]¶ Returns the modeled PWV column density at the current site
Interpolate from the modeled PWV column density at the current site being modeled and return the PWV column density for a given datetime and airmass.
Parameters: - date (datetime) – The date of the desired PWV column density
- airmass (float) – The airmass along line of sight
Returns: The modeled PWV column density at the current site The error in modeled PWV column density
To retrieve the modeled PWV level for November 14, 2016 at 11:06 AM:
1 2 3 4 5 6 | >>> from datetime import datetime
>>> from pwv_kpno import pwv_atm
>>> import pytz
>>>
>>> date = datetime(2016, 11, 14, 11, 6, tzinfo=pytz.utc)
>>> pwv, pwv_err = pwv_atm.pwv_date(date)
|
3.6. Additional Meteorological Data¶
The full set of downloaded SuomiNet measurements for a particular GPS receiver
can be found using the get_all_receiver_data
function. The returned table
includes the PWV measurements for a given receiver, plus measurements of the
GPS zenith delay, surface pressure, surface temperature, and relative humidity.
-
pwv_kpno.pwv_atm.
get_all_receiver_data
(receiver_id, apply_cuts=True)[source]¶ Returns a table of all local SuomiNet data for a given receiver id
Data is returned as an astropy table with columns ‘date’, ‘PWV’, ‘PWV_err’, ‘ZenithDelay’, ‘SrfcPress’, ‘SrfcTemp’, and ‘SrfcRH’.
Parameters: - receiver_id (str) – A SuomiNet receiver id code (eg. KITT)
- apply_cuts (bool) – Whether to apply data cuts from the package settings
Returns: An astropy table with SuomiNet data for the given site