File tree 3 files changed +21
-8
lines changed
docs/sphinx/source/whatsnew
3 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,11 @@ compatibility notes.
10
10
**Python 2.7 support ended on June 1, 2019. ** (:issue: `501 `)
11
11
**Minimum numpy version is now 1.10.4. Minimum pandas version is now 0.18.1. **
12
12
13
+ API Changes
14
+ ~~~~~~~~~~~
15
+ * Calling :py:func: `pvlib.pvsystem.retrieve_sam ` with no parameters will raise
16
+ an exception instead of showing up a dialog.
17
+
13
18
Enhancements
14
19
~~~~~~~~~~~~
15
20
* Created two new incidence angle modifier functions: :py:func: `pvlib.pvsystem.iam_martin_ruiz `
@@ -38,3 +43,4 @@ Contributors
38
43
* Oscar Dowson (:ghuser: `odow `)
39
44
* Anton Driesse (:ghuser: `adriesse `)
40
45
* Alexander Morgan (:ghuser: `alexandermorgan `)
46
+ * Miguel Sánchez de León Peque (:ghuser: `Peque `)
Original file line number Diff line number Diff line change @@ -1717,16 +1717,18 @@ def retrieve_sam(name=None, path=None):
1717
1717
path : None or string, default None
1718
1718
Path to the SAM file. May also be a URL.
1719
1719
1720
- If both name and path are None, a dialogue will open allowing the
1721
- user to select a file.
1722
-
1723
1720
Returns
1724
1721
-------
1725
1722
samfile : DataFrame
1726
1723
A DataFrame containing all the elements of the desired database.
1727
1724
Each column represents a module or inverter, and a specific
1728
1725
dataset can be retrieved by the command
1729
1726
1727
+ Raises
1728
+ ------
1729
+ ValueError
1730
+ If no name or path is provided.
1731
+
1730
1732
Notes
1731
1733
-----
1732
1734
Files available at https://sam.nrel.gov/sites/default/files/
@@ -1781,11 +1783,7 @@ def retrieve_sam(name=None, path=None):
1781
1783
else :
1782
1784
csvdata = path
1783
1785
elif name is None and path is None :
1784
- import tkinter
1785
- from tkinter .filedialog import askopenfilename
1786
-
1787
- tkinter .Tk ().withdraw ()
1788
- csvdata = askopenfilename ()
1786
+ raise ValueError ("A name or path must be provided!" )
1789
1787
1790
1788
return _parse_raw_sam_df (csvdata )
1791
1789
Original file line number Diff line number Diff line change @@ -274,6 +274,15 @@ def pvsyst_module_params():
274
274
return module_parameters
275
275
276
276
277
+ def test_retrieve_sam_raise_no_parameters ():
278
+ """
279
+ Raise an exception if no parameters are provided to `retrieve_sam()`.
280
+ """
281
+ with pytest .raises (ValueError ) as error :
282
+ pvsystem .retrieve_sam ()
283
+ assert 'A name or path must be provided!' == str (error .value )
284
+
285
+
277
286
def test_sapm (sapm_module_params ):
278
287
279
288
times = pd .date_range (start = '2015-01-01' , periods = 5 , freq = '12H' )
You can’t perform that action at this time.
0 commit comments