Skip to content

Commit

Permalink
updated links in README and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BXYMartin committed Feb 14, 2020
1 parent f557c6d commit 5f7dc3d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ClearSkyPy
[![Build Status](https://travis-ci.org/BXYMartin/Python-ClearSkyPy.svg?branch=master)](https://travis-ci.org/BXYMartin/Python-ClearSkyPy)
[![Latest Version](https://img.shields.io/github/v/release/bxymartin/python-clearskypy)](https://test.pypi.org/project/ClearSkyPy/)
# IrradPy
[![Build Status](https://travis-ci.org/BXYMartin/Python-irradpy.svg?branch=master)](https://travis-ci.org/BXYMartin/Python-irradpy)
[![Latest Version](https://img.shields.io/github/v/release/bxymartin/python-irradpy)](https://test.pypi.org/project/irradpy/)

Python script to download data from gesdisc.eosdis.nasa.gov for Clear Sky Model, extract variables from the MERRA-2 reanalysis database and model of clear-sky irradiance.

Expand Down Expand Up @@ -30,26 +30,26 @@ Python script to download data from gesdisc.eosdis.nasa.gov for Clear Sky Model,
#### Use inside Python Script
``` python
# Linux and Unix Users
import clearskypy
import irradpy
# Run Downloader
clearskypy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"})
irradpy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"})
# Run Model
clearskypy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, dataset_dir).REST2v5()
clearskypy.model.ClearSkyMAC2(latitudes, longitudes, elevations, time, dataset_dir).MAC2()
irradpy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, dataset_dir).REST2v5()
irradpy.model.ClearSkyMAC2(latitudes, longitudes, elevations, time, dataset_dir).MAC2()


# Windows Users Only:
import clearskypy
import irradpy
import multiprocessing
# Important Note: If you're using windows, make sure to wrap the function.
if __name__ == "__main__":
multiprocessing.freeze_support()
clearskypy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"})
irradpy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"})

# More Examples

# Download All Data From 2018-01-01 To 2018-01-02
clearskypy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"},
irradpy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"},
initial_year=2018, final_year=2018,
initial_month=1, final_month=1,
initial_day=1, final_day=2,
Expand All @@ -62,8 +62,8 @@ clearskypy.downloader.run(auth={"uid":"USERNAME", "password": "PASSWORD"},
# Run clear sky model from 2018-01-01 To 2018-01-02
time_delta = 10 # minute
timedef = [('2018-01-01T00:00:00', '2018-01-02T0:00:00')]
time = clearskypy.model.timeseries_builder(timedef, time_delta, np.size(latitudes))
clearskypy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, dataset_dir).REST2v5()
time = irradpy.model.timeseries_builder(timedef, time_delta, np.size(latitudes))
irradpy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, dataset_dir).REST2v5()
```

``` python
Expand Down Expand Up @@ -117,7 +117,7 @@ clearskypy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, datase
connection_num : Optional[int]
Number of Connections for each file to be downloaded simutanously.

#clearskypy.model.timeseries_builder:
#irradpy.model.timeseries_builder:
timedef: list [(start time , end time)], optional — specify the start
time(s) and end time(s) of the location(s) of interest.
time_delta: integer, optional — specify the temporal resolution of the
Expand All @@ -126,7 +126,7 @@ clearskypy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, datase
if timedef less than num_station, timeseries_builder will expand it
for every station.

#clearskypy.model.clearSkyRadiation_MAC2.py && clearskypy.model.clearSkyRadiation_REST2v5.py:
#irradpy.model.clearSkyRadiation_MAC2.py && irradpy.model.clearSkyRadiation_REST2v5.py:

latitudes: numpy.ndarray, float, compulsory — Define the latitude(s) of the
location(s) of interest, size must match longitudes.
Expand All @@ -144,7 +144,7 @@ clearskypy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, datase

#### Run Package From Shell
``` bash
python -m clearskypy.downloader.socket --uid USERNAME --password PASSWORD
python -m irradpy.downloader.socket --uid USERNAME --password PASSWORD

usage: socket.py [-h] [--collection_names VAR_NAMES]
[--download_dir DOWNLOAD_DIR] [--initial_year INITIAL_YEAR]
Expand Down Expand Up @@ -208,7 +208,7 @@ python setup.py test
#### Package
```
.
├── clearskypy
├── irradpy
│   ├── __init__.py
│   ├── downloader
│   │   ├── __init__.py
Expand Down Expand Up @@ -248,5 +248,5 @@ python setup.py install
```
With python package:
``` bash
pip install -i https://test.pypi.org/simple/ ClearSkyPy
pip install -i https://test.pypi.org/simple/ irradpy
```
14 changes: 7 additions & 7 deletions example/example_clearsky.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
import clearskypy
import irradpy
import os
# dependency on matplotlib >=3.1
import matplotlib
Expand All @@ -16,31 +16,31 @@
# set some example latitudes, longitudes and elevations
# latitudes range from -90 (south pole) to +90 (north pole) in degrees
latitudes = np.array([[1.300341, 39.97937]])

# longitudes range from -180 (west) through 0 at prime meridian to +180 (east)
longitudes = np.array([[103.771663, 116.34653]])

# elevations are in metres, this influences some solar elevation angles and scale height corrections
elevations = np.array([[43, 53]])

# timedef is a list of pandas time series definition for each location defined.
# Note that an individual time series can be specified per site
timedef = [pd.date_range(start='2018-01-01T20:00:00', end='2018-01-02T15:00:00', freq='10T'),
pd.date_range(start='2018-01-02T20:00:00', end='2018-01-03T15:00:00', freq='10T')]

# use timeseries_builder to build time series for different station
time = clearskypy.model.timeseries_builder(timedef, np.size(latitudes))
time = irradpy.model.timeseries_builder(timedef, np.size(latitudes))

# specify where the downloaded dataset is. It is best to use the os.path.join function
dataset_dir = os.path.join(os.getcwd(), 'MERRA2_data', '2018-1-1~2018-1-3 rad-slv-aer-asm [-90,-180]~[90,180]', '')

# build the clear-sky REST2v5 model object
test_rest2 = clearskypy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, dataset_dir, pandas=True)
test_rest2 = irradpy.model.ClearSkyREST2v5(latitudes, longitudes, elevations, time, dataset_dir, pandas=True)
# run the REST2v5 clear-sky model output is a list of pandas.Dataframe for each station. col: GHI, DNI, DIF, row: time
rest2_output = test_rest2.REST2v5()

# create the MAC2 model class object
test_mac = clearskypy.model.ClearSkyMAC2(latitudes, longitudes, elevations, time, dataset_dir, pandas=True)
test_mac = irradpy.model.ClearSkyMAC2(latitudes, longitudes, elevations, time, dataset_dir, pandas=True)
# run the MAC2 model output is a list of pandas.Dataframe for each station col: GHI, DNI, DIF, row: time
mac2_output = test_mac.MAC2()

Expand Down
4 changes: 2 additions & 2 deletions example/example_downloader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from multiprocessing import freeze_support
import clearskypy
import irradpy
import os
from getpass import getpass

Expand Down Expand Up @@ -73,7 +73,7 @@ def setUp(self):
}

def download(self):
clearskypy.downloader.run(
irradpy.downloader.run(
auth={"uid": self.username, "password": self.password},
initial_year=self.initial_year,
final_year=self.final_year,
Expand Down
6 changes: 3 additions & 3 deletions example/example_extractor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
import clearskypy
import irradpy
import os
# dependency on matplotlib >=3.1
import matplotlib
Expand Down Expand Up @@ -30,7 +30,7 @@
pd.date_range(start='2018-01-02T20:00:00', end='2018-01-03T15:00:00', freq='10T')]

# use timeseries_builder to build time series for different station
time = clearskypy.model.timeseries_builder(timedef, np.size(latitudes))
time = irradpy.model.timeseries_builder(timedef, np.size(latitudes))

# specify where the downloaded dataset is. It is best to use the os.path.join function
dataset_dir = os.path.join(os.getcwd(), 'MERRA2_data', '2018-1-1~2018-1-3 rad-slv-aer-asm [-90,-180]~[90,180]', '')
Expand All @@ -39,7 +39,7 @@
variables = ['SWGDN', 'SWGDNCLR']

# extract the variable from the dataset
MERRA2data = clearskypy.extractor.extractor(latitudes, longitudes, elevations, time, variables, dataset_dir, pandas=True)
MERRA2data = irradpy.extractor.extractor(latitudes, longitudes, elevations, time, variables, dataset_dir, pandas=True)


# Save the data to file, each site = new file
Expand Down
4 changes: 2 additions & 2 deletions test/test_downloader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from multiprocessing import freeze_support
import clearskypy
import irradpy
import unittest
import os

Expand Down Expand Up @@ -69,7 +69,7 @@ def setUp(self):
}

def test_download(self):
clearskypy.downloader.run(
irradpy.downloader.run(
auth={"uid": self.username, "password": self.password},
initial_year=self.initial_year,
final_year=self.final_year,
Expand Down
12 changes: 6 additions & 6 deletions test/test_extractor.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import numpy as np
import clearskypy
import irradpy


def test_extract_MERRA2(lats, lons, datavecs, elevs):
Expand All @@ -24,10 +24,10 @@ def test_extract_MERRA2(lats, lons, datavecs, elevs):
slvpath = 'path to slv dataset'
asmpath = 'path to asm dataset'

aer_var = clearskypy.extractor.extract_dataset(lats, lons, aerpath, aer_pool, datavecs)
rad_var = clearskypy.extractor.extract_dataset(lats, lons, radpath, rad_pool, datavecs)
slv_var = clearskypy.extractor.extract_dataset(lats, lons, slvpath, slv_pool, datavecs)
asm_var = clearskypy.extractor.extract_dataset(lats, lons, asmpath, asm_pool, datavecs, interpolate=False)
aer_var = irradpy.extractor.extract_dataset(lats, lons, aerpath, aer_pool, datavecs)
rad_var = irradpy.extractor.extract_dataset(lats, lons, radpath, rad_pool, datavecs)
slv_var = irradpy.extractor.extract_dataset(lats, lons, slvpath, slv_pool, datavecs)
asm_var = irradpy.extractor.extract_dataset(lats, lons, asmpath, asm_pool, datavecs, interpolate=False)

tot_aer_ext = aer_var[1]
AOD_550 = aer_var[0]
Expand Down Expand Up @@ -56,7 +56,7 @@ def test_extract_dataset_list():
date = ['2019-01-01T12:30:00', '2019-01-04T11:45:00', '2019-01-05T01:30:00']
datapathlist = ['path to dataset1', 'path to dataset2']
rad_pool = ['ALBEDO']
test = clearskypy.extractor.extract_dataset_list(lats, lons, datapathlist, rad_pool, date, interpolate=True)
test = irradpy.extractor.extract_dataset_list(lats, lons, datapathlist, rad_pool, date, interpolate=True)
print(test)


Expand Down

0 comments on commit 5f7dc3d

Please sign in to comment.