Metadata-Version: 2.1
Name: cygnsslib
Version: 1.1.7
Summary: Toolset for working with CYGNSS data and downloading CYGNSS data from PODAC
Home-page: https://bitbucket.org/usc_mixil/cygnsslib
Author: Amer Melebari and James D. Campbell
Author-email: amelebar@usc.edu
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# CYGNSS Library

CYGNSS Library is a Python package for working with CYGNSS data.  

## Installation
you can install it using `pip`  

```console
$ pip install -U -i https://test.pypi.org/simple/ cygnsslib
```
 or you can clone the repository and install it using the following command  
```console
pip install .  
```
You can then remove the local copy if you wish. Alternatively, if you wish to be able to make changes to your local copy without having to reinstall the package for the changes to take effect (e.g., for development purposes), you can use the following instead:
```console
pip uninstall cygnsslib
```
To use it with anaconda, install the environment as follows:  
```console
conda create -n cygnss  
source activate cygnss  
conda install -c conda-forge python matplotlib simplejson numpy netcdf4 geographiclib lxml setuptools  
```
## How to use the code
Example usage:
You can see some examples in the testing folder, also the code below  

```python
import cygnsslib 
import os

cygnss_l1_dir = os.environ["CYGNSS_L1_PATH"]  # Default path 

cygnsslib.write_sp_from_kml(cygnss_l1_dir, year=[2019], daylist=[50,51,52], in_kml='salar_poly.kml', out_root='salar_sp',
 thresh_ddm_snr=-9999., thresh_noise=3, out_options=None)
cygnsslib.plot_brcs(cygnss_l1_dir,year=2018,day=52,sc_num=7,ch_num=1,samp_num=38789,tag_png="salar",tag_title="Salar")
```

To download CYGNSS data see the following example
```python
from getpass import getpass
import cygnsslib
import datetime as dt
import numpy as np
import os


# Download data in the same year and range of days
data_day = np.arange(5, 10)
data_year = 2020
# sc_num = [3]
sc_num = None  # Will download all the 8 spacecrafts 
re_download = False
cyg_data_ver = 'v2.1'
cygnss_l1_path = os.environ["CYGNSS_L1_PATH"]
cygnsslib.download_cyg_files(data_year, data_day, list_sc_num=sc_num, cyg_data_ver=cyg_data_ver,
                   cyg_data_lvl='L1', cygnss_l1_path=cygnss_l1_path, re_download=re_download)

# Downloading data between two dates (including end date)
st_date = dt.date(year=2019, month=1, day=12)
end_date = dt.date(year=2020, month=1, day=3)

cygnsslib.download_cyg_files_between_date(st_date, end_date, list_sc_num=sc_num, cyg_data_ver=cyg_data_ver,
                                cyg_data_lvl='L1', cygnss_l1_path=cygnss_l1_path, re_download=re_download)

```

where
- CYGNSS Level 1 data are available in [PPODAAC](https://podaac-tools.jpl.nasa.gov/drive/files/allData/cygnss/L1) 
- `salar_poly.kml` file can be generated by drawing a polygon in Google Earth Pro (e.g., inside the Salar de Uyuni in Bolivia) and saving as a KML file.

