HARPgroup / HARParchive

This repo houses HARP code development items, resources, and intermediate work products.
1 stars 0 forks source link

2021/12/22 Set Up Model Scenario for new NLDAS #145

Open rburghol opened 2 years ago

rburghol commented 2 years ago
making UCI for cid segment F51125 land scenario p532sova_2021
global  files   opseq   At line 181 of file dsn_utils.f
Fortran runtime error: End of record

Error termination. Backtrace:

0 0x7fda46580d5a

HARPgroup/HARParchive#1 0x7fda46581869 HARPgroup/HARParchive#2 0x7fda4658254f HARPgroup/HARParchive#3 0x7fda467c4e10 HARPgroup/HARParchive#4 0x7fda467d2eeb HARPgroup/HARParchive#5 0x7fda467d3f76 HARPgroup/HARParchive#6 0x7fda467c553d HARPgroup/HARParchive#7 0x556c1dd0b0c1 HARPgroup/HARParchive#8 0x556c1dce854e HARPgroup/HARParchive#9 0x556c1dcc4297 HARPgroup/HARParchive#10 0x556c1dcc69ea HARPgroup/HARParchive#11 0x556c1dcc700e HARPgroup/HARParchive#12 0x7fda4622b0b2 HARPgroup/HARParchive#13 0x556c1dcae38d HARPgroup/HARParchive#14 0xffffffffffffffff

rburghol commented 2 years ago

Created small test segment for Mount Alto (only 1 landseg). ./run_lug.csh p532sova_2021 JL2_6850_6890_8547531

rburghol commented 2 years ago
rburghol commented 2 years ago

Script to flexibly add lines to any of the annual files:


def_landseg = 'ALL'
def_path = "../../"
def_type = 'atdep' # later will maybe add others, and support "ALL"

# Read Args
# test with:    argst <- c('p532cal_062211', "A51007")
argst <- commandArgs(trailingOnly=T) # scenario, landseg(ALL), path ("../../")
if (length(argst) == 0) {
  message(paste0('Usage:  make_empty_atdep.R scenario [landseg=', def_landseg, '] [path="', def_path,'"] '))
  stop
}
scenario <- argst[1]
if (length(argst) > 1) {
  def_landseg = argst[2]
}
if (length(argst) > 2) {
  def_path = argst[3]
}
landseg = def_landseg
path = def_path

fpat <- "annual"
fpat <- paste0(fpat, '_', def_type)

if (landseg != 'ALL') {
  fpat <- paste0(fpat, '_', landseg)
} 

# set up the path
path <- paste0(path, "output/input/", scenario)
# read all matching file names
flist <- list.files(path=path, pattern=fpat, full.names=TRUE)

for (findex in 1:length(flist) ) {
  fname <- flist[findex]
  adf <- read.csv(fname)
  adim <- ncol(adf)
  ats <- array(dim=adim)
  ats[2:adim] <- 0.0
   i = max(adf[1]) + 1
  imax = 2021; # should be passed in as arg
  while (i <= imax) {
    ats[1] = i
    adf <- rbind(adf, ats)
    i = i + 1
  }
  write.csv(adf, fname, quote=FALSE, row.names=FALSE)
}
rburghol commented 2 years ago

Errorwhen runing southern river:

rob@deq2:/opt/model/p53/p532c-sova/run/standard$ ./run_lug.csh p532sova_2021 stoney
making UCI for for segment A51071 land scenario p532sova_2021
global  files   opseq

 PROBLEM FILE WRITTEN

could not open file
../../../input/scenario/climate/prad/p20211221/prad_A51071.wdm

Looks like A51071 is missing, but B and C exist

ls ../../input/scenario/climate/prad/p20211221 -lhrt | grep 51071
-rwxrwxr-x+ 1 7442902 allmodelers 640K Dec  6 16:57 prad_N51071.wdm
-rwxrwxr-x+ 1 7442902 allmodelers 600K Dec  6 17:31 prad_B51071.wdm
-rwxrwxr-x+ 1 7442902 allmodelers 560K Dec  6 17:31 prad_C51071.wdm
rburghol commented 2 years ago
cp /opt/model/p53/p532c-sova/input/scenario/climate/prad/p20211221/prad_N51800.wdm /tmp
wdimex
rob@deq2:/tmp$ wdimex
 Enter name of WDM file:
prad_N51800.wdm
/usr/local/lib/hspf/message.wdm

 Do you want to Import, Export or Return to operating system (I,E,R)?
E

 Enter name of sequential file for output:
prad_N51800.txt

 Enter comment line(s) for export file, use Enter (carriage return) to quit.

 Export All or Selected DSN/CLUs (A,S)?
A
 Beginning export of DSN/CLU  2007 type is TIME
 Completed export of DSN/CLU  2007
 Beginning export of DSN/CLU  2000 type is TIME
 Completed export of DSN/CLU  2000
 Beginning export of DSN/CLU  2001 type is TIME
 Completed export of DSN/CLU  2001
 Beginning export of DSN/CLU  2002 type is TIME
 Completed export of DSN/CLU  2002
 Beginning export of DSN/CLU  2003 type is TIME
 Completed export of DSN/CLU  2003
 Beginning export of DSN/CLU  2004 type is TIME
 Completed export of DSN/CLU  2004
 Beginning export of DSN/CLU  2005 type is TIME
 Completed export of DSN/CLU  2005
 Beginning export of DSN/CLU  2006 type is TIME
 Completed export of DSN/CLU  2006
rburghol commented 2 years ago
source `find_config hspf.conf`

cd $CBP_ROOT/code/src/lib/dsn
# OR 
cd $CBP_ROOT/code/src/lug/ 
rburghol commented 2 years ago
rburghol commented 2 years ago
rburghol commented 2 years ago
rburghol commented 2 years ago

Create new calibration holder:

cbp copy_params.csh p532sova_2021 p532sova_cal
cbp copy_PWATER_params.csh p532sova_2021 p532sova_cal
# created by RWB to duplicate a scenario
cbp copy_river_scenario_params.csh p532cal_062211 p532sova_cal
cbp make_land_directories.csh p532sova_cal
cbp make_river_directories.csh p532sova_cal
cbp copy_calib.csh p532hydro p532sova_cal
# created by RWB to duplicate a scenario
cbp copy_land_control.csh p532sova_2021 p532sova_cal
cbp copy_river_control.csh p532sova_2021 p532sova_cal

Edit land control nano config/control/land/p532sova_cal.con

PARAMETERS
p532sova_cal
END PARAMETERS
...
CALIBSCEN
p532sova_cal
END CALIBSCEN

Edit river control nano config/control/river/p532sova_cal.con

PARAMETERS
p532sova_cal
END PARAMETERS
...
CALIBSCEN
p532sova_cal
END CALIBSCEN

Test the model:

cbp run_all.csh p532sova_cal OR2_8130_7900

Recalibrate:

cbp compile_PWATER_opt.csh p532sova_hydro
cbp run_PWATER_optimization.csh p532sova_cal p532sova_hydro OR2_8130_7900
rburghol commented 2 years ago

cbp run_all.csh p532sova_2021 OR7_8490_0000 forF51019.wdm