diff --git a/README.md b/README.md index 12aad89..7f40901 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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, @@ -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 @@ -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 @@ -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. @@ -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] @@ -208,7 +208,7 @@ python setup.py test #### Package ``` . -├── clearskypy +├── irradpy │   ├── __init__.py │   ├── downloader │   │   ├── __init__.py @@ -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 ``` diff --git a/example/example_clearsky.py b/example/example_clearsky.py index 87a4634..618982b 100755 --- a/example/example_clearsky.py +++ b/example/example_clearsky.py @@ -1,5 +1,5 @@ import numpy as np -import clearskypy +import irradpy import os # dependency on matplotlib >=3.1 import matplotlib @@ -16,10 +16,10 @@ # 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]]) @@ -27,20 +27,20 @@ # 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() diff --git a/example/example_downloader.py b/example/example_downloader.py index b1211fc..b338e4d 100644 --- a/example/example_downloader.py +++ b/example/example_downloader.py @@ -1,5 +1,5 @@ from multiprocessing import freeze_support -import clearskypy +import irradpy import os from getpass import getpass @@ -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, diff --git a/example/example_extractor.py b/example/example_extractor.py index cc3213c..ca3a36e 100644 --- a/example/example_extractor.py +++ b/example/example_extractor.py @@ -1,5 +1,5 @@ import numpy as np -import clearskypy +import irradpy import os # dependency on matplotlib >=3.1 import matplotlib @@ -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]', '') @@ -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 diff --git a/test/test_downloader.py b/test/test_downloader.py index 84b2ec8..d9291c3 100644 --- a/test/test_downloader.py +++ b/test/test_downloader.py @@ -1,5 +1,5 @@ from multiprocessing import freeze_support -import clearskypy +import irradpy import unittest import os @@ -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, diff --git a/test/test_extractor.py b/test/test_extractor.py index d37159f..2a0d4fc 100644 --- a/test/test_extractor.py +++ b/test/test_extractor.py @@ -1,5 +1,5 @@ import numpy as np -import clearskypy +import irradpy def test_extract_MERRA2(lats, lons, datavecs, elevs): @@ -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] @@ -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)