Reputation: 21
I am currently trying to create a PVlib project where I am attempting to import Solar modules .pan files and inverter .ond files provided to me but other than the retrieve_sam
command. I am not seeing a capability to import existing .pan and .ond files from my laptop for PVlib to read the same.
Additionally, I used the IO Tool APIs to import meteorological data from PVGIS but when I already have existing data from SolarGIS, I am not sure how I can import it into the library from my laptop.
Appreciate the help coming over for this. Thank you!
Upvotes: 2
Views: 1509
Reputation: 5189
I just had this issue, I have some weather files with .pvsyst
extensions (you can see the head of the file below) and I found it easier to just use the pandas.
First, change the extension of the file to .csv
, then open the file and check if it has any comments or info lines. In my case, the files start with many comment lines and also one line with info regarding unit:
#TMY hourly data
#Standard format for importing hourly data in PVsyst
#Created from EnergyPlus Weather Converter version=2022.04.01
#WMO=105130Data Source=Custom-105130
#Site,Koln.Bonn.AP
#Country,DEU
#Data Source,Custom-105130 WMO=105130
#Time step,Hour
#Latitude,50.864
#Longitude,7.158
#Altitude,100
#Time Zone,1.00
Year,Month,Day,Hour,Minute,GHI,DHI,DNI,Tamb,WindVel,WindDir
,,,,,W/m2,W/m2,W/m2,deg.C,m/sec,�
2059,1,1,1,30,0,0,0,0.000,1.00,21
2059,1,1,2,30,0,0,0,0.000,1.00,120
This means I need to tell the pandas that the lines that start with #
are comments and later drop the first index:
df = pd.read_csv('weather.csv', comment='#')
print(df.head())
df = df.drop(0)
print(df.head())
Output:
Year Month Day Hour Minute GHI DHI DNI Tamb WindVel WindDir
0 NaN NaN NaN NaN NaN W/m2 W/m2 W/m2 deg.C m/sec �
1 2059.0 1.0 1.0 1.0 30.0 0 0 0 8.000 3.00 250
2 2059.0 1.0 1.0 2.0 30.0 0 0 0 8.000 4.00 260
3 2059.0 1.0 1.0 3.0 30.0 0 0 0 8.000 4.00 240
4 2059.0 1.0 1.0 4.0 30.0 0 0 0 8.000 4.00 240
Year Month Day Hour Minute GHI DHI DNI Tamb WindVel WindDir
1 2059.0 1.0 1.0 1.0 30.0 0 0 0 8.000 3.00 250
2 2059.0 1.0 1.0 2.0 30.0 0 0 0 8.000 4.00 260
3 2059.0 1.0 1.0 3.0 30.0 0 0 0 8.000 4.00 240
4 2059.0 1.0 1.0 4.0 30.0 0 0 0 8.000 4.00 240
5 2059.0 1.0 1.0 5.0 30.0 0 0 0 8.000 4.00 240
Upvotes: 0
Reputation: 3411
pvlib doesn't currently have any functionality for reading PVsyst files, but some other people have made python code to do so, e.g. https://github.com/frivollier/pvsyst_tools. Here is some relevant discussion from the pvlib google group: https://groups.google.com/g/pvlib-python/c/PDDic0SS6ao/m/Z-WKj7C6BwAJ
For reading your existing data files, if pvlib.iotools
does not have a suitable function, you can always DIY using pandas (e.g. pandas.read_csv or similar). Most of the iotools
functions use pandas under the hood anyway. To give a more specific recommendation we'd need to see a snippet of your file to see exactly what format it is in.
Upvotes: 1