Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F112803867
interpolate_covrr.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 13, 02:06
Size
773 B
Mime Type
text/x-python
Expires
Thu, May 15, 02:06 (2 d)
Engine
blob
Format
Raw Data
Handle
26130484
Attached To
R8800 solar_potential
interpolate_covrr.py
View Options
import
numpy
as
np
import
pandas
as
pd
import
xarray
as
xr
from
pvlib.solarposition
import
get_solarposition
import
util
import
os
import
time
import
sys
### USER INPUT
FILEPATH
=
sys
.
argv
[
1
]
# file path (WITHOUT EXTENSION!)
# Load uncertainty
fp
=
'
%s
.nc'
%
FILEPATH
phys_pot
=
xr
.
open_mfdataset
(
fp
,
chunks
=
{
'x'
:
200
,
'y'
:
200
})
# Step 1: change timestamp
phys_pot_corrected
=
phys_pot
.
copy
()
phys_pot_corrected
.
coords
[
'timestamp'
]
=
phys_pot_corrected
.
timestamp
+
pd
.
Timedelta
(
0.5
,
unit
=
'h'
)
# Step 2: interpolate corrected data to old timestamps
phys_pot_interp
=
phys_pot_corrected
.
interp
(
timestamp
=
phys_pot
.
timestamp
)
# Step 3: save results
fp
=
'
%s
_interp.nc'
%
FILEPATH
print
(
'Interpolated results; now saving to file
%s
'
%
fp
)
phys_pot_interp
.
to_netcdf
(
fp
)
Event Timeline
Log In to Comment