EarthyScience / REddyProc

Processing data from micrometeorological Eddy-Covariance systems
58 stars 33 forks source link

Issue trying to partition NEE to Reco & GPP w/ v 1.0.0 #2

Closed serbinsh closed 6 years ago

serbinsh commented 7 years ago

Hello

We have been successfully running v 0.8-2 but recently we installed 1.0.0 on a new computer and are running into an error midway through our gapfill/partition script:

Start flux partitioning for variable NEE_NoUstar_f with temperature Tair_f. Error in .self$sCalcPotRadiation(useSolartime.b = !isTRUE(debug.l$useLocaltime.b)) : Need to set valid location information (sSetLocationInfo) before calling sCalcPotRadiation.

When running "sMRFluxPartition"

> EddyProc.C$sMRFluxPartition(Lat_deg.n=latitude, Long_deg.n=longitude, TimeZone_h.n=TimeZone, Suffix.s='NoUstar',
+                             debug.l = list(useLocaltime.b = TRUE))
Start flux partitioning for variable NEE_NoUstar_f with temperature Tair_f.
Error in .self$sCalcPotRadiation(useSolartime.b = !isTRUE(debug.l$useLocaltime.b)) : 
  Need to set valid location information (sSetLocationInfo) before calling sCalcPotRadiation.

We noticed that we now need to run:

EddyProc.C$sSetLocationInfo(Lat_deg.n=latitude, Long_deg.n=longitude, TimeZone_h.n=TimeZone)

Which we have done but we still get this error. This code used to work so it seems we may be missing a flag/switch or some other setting to get this to run. We have tried to add/remove the debug flag which hasn't fixed it for us

Any help would be much appreciated. Thanks!

serbinsh commented 7 years ago

Here is a bit more of the code preceding:


#--------------------------------------------------------------------------------------------------#
#+++ Partition NEE into GPP and respiration --- Processing with ustar filtering before  
#EddyProc.C <- sEddyProc$new(paste0(site), EddyDataWithPosix.F, c('NEE','Rg','Tair','VPD', 'Ustar'),DTS.n = freq)
EddyProc.C <- sEddyProc$new(paste0(site), EddyDataWithPosix.F, c('NEE','LE','H','Rg','Tair','VPD', 'Ustar'),DTS.n = freq)
# estimating the thresholds based on the data
uStarTh <- EddyProc.C$sEstUstarThreshold()$uStarTh
uStarTh

# plot saturation of NEE with UStar for one season
EddyProc.C$sPlotNEEVersusUStarForSeason( levels(uStarTh$season)[4], Dir.s = out.dir, Format.s = "pdf" )

# Gapfilling by default it takes the annually aggregated estimate to mark periods with low uStar
EddyProc.C$sMDSGapFill('NEE', FillAll.b=FALSE, Suffix.s='NoUstar')  # Gap fill without ustar
EddyProc.C$sMDSGapFillAfterUstar('NEE') # Gap fill NEE with ustar
colnames(EddyProc.C$sExportResults()) # Note the collumns with suffix _WithUstar    
EddyProc.C$sMDSGapFill('Tair', FillAll.b=FALSE) # Gap-filled Tair needed for partitioning

#+++ Flux partitioning
EddyProc.C$sMRFluxPartition(Lat_deg.n=latitude, Long_deg.n=longitude, TimeZone_h.n=TimeZone, Suffix.s='NoUstar')
EddyProc.C$sMRFluxPartition(Lat_deg.n=latitude, Long_deg.n=longitude, TimeZone_h.n=TimeZone, Suffix.s='WithUstar')

#+++ Export gap filled and partitioned data to standard data frame
FilledEddyData.F <- EddyProc.C$sExportResults()
bgctw commented 6 years ago

You need to re-run EddyProc.C$sSetLocationInfo when you create a new class by EddyProc.C <- sEddyProc$new before you call EddyProc.C$sMRFluxPartition. In your previous comment I do not see a call to sSetLocationInfo.

bgctw commented 6 years ago

Closing this outdated issue.