Skip to content

Commit

Permalink
making small updates/changes to the COG generation file (mostly forma…
Browse files Browse the repository at this point in the history
…tting)
  • Loading branch information
aestears committed Sep 13, 2024
1 parent ac92e6c commit df9f983
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 13 deletions.
Binary file modified .DS_Store
Binary file not shown.
21 changes: 21 additions & 0 deletions main/implementation/COG_metadata.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FileName,NetCDF_1,NetCDF_2,FileDescription,Units
TMean_prediction_MeanOverNext90Days_from_2024-09-17_to_2024-12-09.tif,tmean_dy_gridSTDF_median-prediction.nc,,The mean of forecasted mean daily air temperature in this gridcell over the 90 days following the date when the forecast was run. The specific dates across which the temperature is averaged are given at the end of the file name ,degrees C
TMean_predictionDiffFromNormalPeriod_MeanOverNext90Days_from_2024-09-17_to_2024-12-09.tif,tmean_dy_gridSTDF_median-prediction.nc,tmean_dy_gridSTDF_historical_19910101-20201231-median.nc,"The mean across the next 90 days after the forecasting date of the daily difference between forecasted mean daily air temperature and mean daily air temperature during the normal period. The specific dates across which the temperature is averaged are given at the end of the file name. Value in a grid cell = mean((forecastedTemp_day1 - normalPeriodTemp_day1), (forecastedTemp_Day2 - normalPeriodTemp_day2),...,(forecastedTemp_Day90 - normalPeriodTemp_day90)",degrees C
GISSM_HistoricalPreds_means_from_1991_to_2020.tif,GISSM_yr_gridSTDF_historical.nc,NA,"The mean hind-casted probability of sagebrush seedling establishment in the following year calculated using the GISSM (Schlapefer et al., 2014) model based on conditions in each year across the historical normal period (1991 - 2020). The years at the end of the file name indicate the years of the historical normal period used. ",Probability
GISSM_MeanPredictedAnomaliesRelativeToHistoricalMeans_for_2024.tif,GISSM_yr_gridSTDF_historical.nc,GISSM_yr_gridSTDF_prediction.nc,"The difference in sagebrush seedling establishment probability predicted by the GISSM (Schlaepfer et al., 2014) model based on conditions in the current year (the year that the simulation was run) compared to the mean predicted probability of establishment based on conditions during the normal period. The probability of establishment based on conditions in the current year is an average of predicted probabilities from 30 simulations. The value at the end of the file name indicates the year whose conditions are input into the GISSM model (the model predicts sagebrush establishment in the year after the year indicated in the file name). Value in grid cell = mean(P(establishment based on conditions in current year)_ simulation1, ..., P(establishment based on conditions in current year)_ simulation30) - meanP(establishment based on conditions from 1991-2020). ",Probability
GISSM_MeanPredictedAnomaliesRelativeToHistoricalMeans_for_2025.tif,GISSM_yr_gridSTDF_historical.nc,GISSM_yr_gridSTDF_prediction.nc,"The difference in sagebrush seedling establishment probability predicted by the GISSM (Schlaepfer et al., 2014) model based on conditions in the following year (the year after the year in which the simulation was run) compared to the mean predicted probability of establishment based on conditions during the normal period. The probability of establishment based on conditions in the next year is an average of predicted probabilities from 30 simulations. The value at the end of the file name indicates the year whose conditions are input into the GISSM model (the model predicts sagebrush establishment in the year after the year indicated in the file name). Value in grid cell = mean(P(establishment based on conditions in next year)_ simulation1, ..., P(establishment based on conditions in next year)_ simulation30) - meanP(establishment based on conditions from 1991-2020). ",Probability
OConnorPredicted_NumberOfMoistAndWarmDays_March_2025.tif,oconnor-swp_dy_gridSTDF_mean-prediction.nc,oconnor-soiltemp_dy_gridSTDF_mean-prediction.nc,"The number of days in the next month of March following the forecast date during which the forecasted soil water potential is greater than -2.5 MPa and theforecasted mean air temperature is greater than 0 degrees C. These conditions were identified by O'Connor et al. 2020 as favorable for Sagebrush germination. The year at the end of the file name indicates the year these forecasted days fall in. For example, if a forecast simulation is run prior to March in a given year, the predicted number of warm and wet days indicated in this dataset will correspond to the month of March in the year when the forecast was run. If the the forecast simulation is run during or after March in a given year, the predicted number of warm and wet days will correspond to the month of March in the year following the year when the forecast was run. ",Days
OConnorPredicted_NumberOfVeryMoistDays_March_2025.tif,oconnor-swp_dy_gridSTDF_mean-prediction.nc,,"The number of days in the next month of March following the forecast date during which the forecasted soil water potential is greater than -0.05 MPa and less than 0 MPa. These conditions were identified by O'Connor et al. 2020 as very favorable for Sagebrush germination. The year at the end of the file name indicates the year these forecasted days fall in. For example, if a forecast simulation is run prior to March in a given year, the predicted number of very wet days indicated in this dataset will correspond to the month of March in the year when the forecast was run. If the the forecast simulation is run during or after March in a given year, the predicted number of very wet days will correspond to the month of March in the year following the year when the forecast was run. ",Days
Precip_prediction_MeanOverNext90Days_from_2024-09-17_to_2024-12-09.tif,ppt_dy_gridSTDF_median-prediction.nc,,The mean of forecasted total daily precipitation in this gridcell over the 90 days following the date when the forecast was run. The specific dates across which the precipitation is averaged are given at the end of the file name ,mm
Precip_predictionDiffFromNormalPeriod_MeanOverNext90Days_from_2024-09-17_to_2024-12-09.tif,ppt_dy_gridSTDF_median-prediction.nc,ppt_dy_gridSTDF_historical_19910101-20201231-median.nc,"The mean across the next 90 days after the forecasting date of the daily difference between forecasted total daily precipitation and mean total daily precipitation during the normal period. The specific dates across which the precipitation is averaged are given at the end of the file name. Value in a grid cell = mean((forecasted{Precip_day1 - normalPeriodPrecip_day1), (forecastedPrecip_Day2 - normalPeriodPrecip_day2),...,(forecastedPrecip_Day90 - normalPeriodPrecip_day90)",mm
ShriverHistoricalPreds_medians_from_1991_to_2020.tif,shriver_yr_gridSTDF_historical.nc,,"The mean hind-casted probability of sagebrush seeding success based on conditions in each year across the historical normal period (1991 - 2020), calculated using the model from Shriver et al., 2018. The years at the end of the file name indicate the years of the historical normal period used. ",Probability
ShriverPredictedMedianRelativeToHistoricalData_for_2024.tif,shriver_yr_gridSTDF_prediction.nc,shriver_yr_gridSTDF_historical.nc,"The difference in probability of sagebrush seeding success predicted by the Shriver et al., 2018 model based on conditions in the current year (the year that the simulation was run) compared to the mean predicted probability sagebrush seeding success based on conditions during the normal period (1991-2020). The probability of success based on conditions in the current year is an average of predicted probabilities from 30 simulations. The value at the end of the file name indicates the year whose conditions are input into the model. Value in grid cell = mean(P(success based on conditions in current year)_ simulation1, ..., P(success based on conditions in current year)_ simulation30) - meanP(success based on conditions from 1991-2020). ",Probability
ShriverPredictedMedianRelativeToHistoricalData_for_2025.tif,shriver_yr_gridSTDF_prediction.nc,shriver_yr_gridSTDF_historical.nc,"The difference in probability of sagebrush seeding success predicted by the Shriver et al., 2018 model based on conditions in the following year (the year after the year that the simulation was run) compared to the mean predicted probability sagebrush seeding success based on conditions during the normal period (1991-2020). The probability of success based on conditions in the following year is an average of predicted probabilities from 30 simulations. The value at the end of the file name indicates the year whose conditions are input into the model. Value in grid cell = mean(P(success based on conditions in following year)_ simulation1, ..., P(success based on conditions in following year)_ simulation30) - meanP(success based on conditions from 1991-2020). ",Probability
VWC_surface_prediction_FallMeans_for_2024.tif,vwc-shallow_dy_gridSTDF_median-prediction.nc,,"The mean of forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) during Fall months (September - November) in the year when the forecast was run. The value at the end of the file name indicates the year that this this average ""Fall"" vwc corresponds to.. Note that the average is limited to the dates for which a forecast is generated -- for example, if a forecast is run in October, then the average of surface vwc for Fall of the current year would only include values for October and November (and exclude September). ",cm/cm
VWC_surface_prediction_FallMeans_for_2025.tif,vwc-shallow_dy_gridSTDF_median-prediction.nc,,"The mean of forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) during Fall months (September - November) in the year following the year in which the forecast was run. The value at the end of the file name indicates the year that this this average ""Fall"" vwc corresponds to.",cm/cm
VWC_surface_predictionDiffFromNormalPeriod_Fall_for_2024.tif,vwc-shallow_dy_gridSTDF_median-prediction.nc,,"The mean across Fall months (September - November) of the daily difference between forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) in the current year and mean daily vwc during the normal period. The value at the end of the file name indicates the year that this this comparison of ""Fall"" vwc corresponds to. Value in a grid cell = mean((forecastedVwc_CurrentYearday1 - normalPeriodVwc_CurrentYearday1), (forecastedVwc_CurrentYearDay2 - normalPeriodVwc_CurrentYearday2),...,(forecastedVwc_Day90 - normalPeriodVwc_day90)",cm/cm
VWC_surface_predictionDiffFromNormalPeriod_Fall_for_2025.tif,vwc-shallow_dy_gridSTDF_median-prediction.nc,,"The mean across Fall months (September - November) of the daily difference between forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) in the next year and mean daily vwc during the normal period. The value at the end of the file name indicates the year that this this comparison of ""Fall"" vwc corresponds to. Value in a grid cell = mean((forecastedVwc_NextYearday1 - normalPeriodVwc_NextYearday1), (forecastedVwc_NextYearDay2 - normalPeriodVwc_NextYearday2),...,(forecastedVwc_Day90 - normalPeriodVwc_day90)",cm/cm
VWC_surface_prediction_growingSeasonMeans_for_2024.tif,vwc-shallow_dy_gridSTDF_median-prediction.nc,,"The mean of forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) during growigng season months (May - September) in the year when the forecast was run. The value at the end of the file name indicates the year that this this average ""growing season"" vwc corresponds to. Note that the average is limited to the dates for which a forecast is generated -- for example, if a forecast is run in September, then the average of surface vwc for the growing season of the current year would only include values for September. ",cm/cm
VWC_surface_prediction_growingSeasonMeans_for_2025.tif,vwc-shallow_dy_gridSTDF_median-prediction.nc,,"The mean of forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) during growigng season months (May - September) in the year following the year in which the forecast was run. The value at the end of the file name indicates the year that this this average ""growing season"" vwc corresponds to.",cm/cm
VWC_surface_predictionDiffFromNormalPeriod_growingSeason_for_2024.tif,vwc-shallow_dy_gridSTDF_median-diffs-prediction.nc,,"The mean across growing season months (May-September) of the daily difference between forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) in the current year and mean daily vwc during the normal period. The value at the end of the file name indicates the year that this this comparison of ""growing season"" vwc corresponds to. Value in a grid cell = mean((forecastedVwc_CurrentYearday1 - normalPeriodVwc_CurrentYearday1), (forecastedVwc_CurrentYearDay2 - normalPeriodVwc_CurrentYearday2),...,(forecastedVwc_Day90 - normalPeriodVwc_day90)",cm/cm
VWC_surface_predictionDiffFromNormalPeriod_growingSeason_for_2025.tif,vwc-shallow_dy_gridSTDF_median-diffs-prediction.nc,,"The mean across growing season months (May-September) of the daily difference between forecasted daily volumetric water content (vwc) in Shallow Soil Layers (0 - 15cm soil depth) in the next year and mean daily vwc during the normal period. The value at the end of the file name indicates the year that this this comparison of ""growing season"" vwc corresponds to. Value in a grid cell = mean((forecastedVwc_NextYearday1 - normalPeriodVwc_NextYearday1), (forecastedVwc_NextYearDay2 - normalPeriodVwc_NextYearday2),...,(forecastedVwc_Day90 - normalPeriodVwc_day90)",cm/cm
Binary file added main/implementation/COG_metadata.xls
Binary file not shown.
18 changes: 5 additions & 13 deletions projects/07_TestOutputForFRESC/CreateCOGs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ rm(list=ls(all = TRUE))
#library(rgdal)
library(terra)
library(lubridate)
# -of COG -co BLOCKSIZE=512 -co RESAMPLING=BILINEAR -co COMPRESS=DEFLATE -co NUM-THREADS=25 -co BIGTIFF=YES

# need to decide which year of ecological variable are being shown (show
# current year until a certain point, then switch to the next year)--just need to
# document clearly which data is being used Blue text is actual list of COGs
# (rather than text that describes what we want) (green text indicates names of
# netCDFs to calculate variables required)


# Get date information and prep for loading files ----------------------------------------------------
currDOY <- lubridate::yday(Sys.Date())
Expand Down Expand Up @@ -37,7 +29,7 @@ shriver_hist_probsNorm <- subset(shriver_hist_probs, 1:30)
# calculate medians
shriver_hist_meds <- median(shriver_hist_probsNorm, na.rm = TRUE)
# save the median data as a COG
terra::writeRaster(shriver_hist_meds, filename = paste0(outLoc,"ShriverHistoricalPreds_medians_from_", shriver_hist_time[1],"_to_",shriver_hist_time[30],".tif"), gdal = "COG")
terra::writeRaster(shriver_hist_meds, filename = paste0(outLoc,"ShriverHistoricalPreds_medians_from_1991_to_2020.tif"), gdal = "COG")

# Shriver model: Probability of establishment for the next year relative to median values ---------------------------------------------------------
# (median calculated from shriver_yr_gridSTDF_historical.nc;
Expand Down Expand Up @@ -101,7 +93,7 @@ terra::writeRaster(goodDaysPerCell,
#values overlap with the blue line from the figure, are substantially above it,
#or substantially below it)

#OConnor: Predicted of days soil MPa was between 0.5 and 0 in March ---------------------------------------------------------------
#OConnor: Predicted of days soil MPa was between -0.5 and 0 in March ---------------------------------------------------------------
#(get from oconnor-swp_dy_gridSTDF_mean-prediction.nc file) # both for for
#current year prior to cutoff month; for next year after cutoff month (?) #
## the year for data shown is indicated in the file name
Expand Down Expand Up @@ -133,7 +125,7 @@ GISSM_hist_probsNorm <- subset(GISSM_hist_probs, which(GISSM_hist_time %in% c(19
GISSM_hist_means <- mean(GISSM_hist_probsNorm, na.rm = TRUE)

# save the median data as a COG
terra::writeRaster(GISSM_hist_means, filename = paste0(outLoc,"GISSM_HistoricalPreds_means_from_", GISSM_hist_time[1],"_to_",GISSM_hist_time[30],".tif"), gdal = "COG", overwrite = TRUE)
terra::writeRaster(GISSM_hist_means, filename = paste0(outLoc,"GISSM_HistoricalPreds_means_from_", GISSM_hist_time[1]-1,"_to_",GISSM_hist_time[30]-1,".tif"), gdal = "COG", overwrite = TRUE)

# GISSM: Probability of seedling survival for the next year relative to median historical values -----------------------------------------------------------------

Expand All @@ -155,7 +147,7 @@ GISSM_preds_time_1 <- 1970 + round(var.get.nc(ncfile = open.nc(paste0(fileLoc, "
GISSM_preds_anoms_1 <- GISSM_preds_mean_1 - GISSM_hist_means
# save the median data as a COG
terra::writeRaster(GISSM_preds_anoms_1,
filename = paste0(outLoc,"GISSM_MeanPredictedAnomaliesRelativeToHistoricalMeans_from_", GISSM_preds_time_1,".tif"), gdal = "COG")
filename = paste0(outLoc,"GISSM_MeanPredictedAnomaliesRelativeToHistoricalMeans_for_", GISSM_preds_time_1,".tif"), gdal = "COG")

## get data for year 2
GISSM_preds_2 <- terra::subset(GISSM_preds, 31:60)
Expand All @@ -167,7 +159,7 @@ GISSM_preds_time_2 <- 1970 + round(var.get.nc(ncfile = open.nc(paste0(fileLoc, "
GISSM_preds_anoms_2 <- GISSM_preds_mean_2 - GISSM_hist_means
# save the median data as a COG
terra::writeRaster(GISSM_preds_anoms_2,
filename = paste0(outLoc,"GISSM_MeanPredictedAnomaliesRelativeToHistoricalMeans_from_", GISSM_preds_time_2,".tif"), gdal = "COG")
filename = paste0(outLoc,"GISSM_MeanPredictedAnomaliesRelativeToHistoricalMeans_for_", GISSM_preds_time_2,".tif"), gdal = "COG")

# Soil Moisture: Mean predicted surface (?) soil moisture for growing season -----------------------------------------------------------
# (define differently for different regions?) (from vwc-shallow_dy_gridSTDF_median-prediction.nc)
Expand Down

0 comments on commit df9f983

Please sign in to comment.