Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evapotransparation data from other AWAP #5

Open
ivanhanigan opened this issue Jul 19, 2017 · 0 comments
Open

Evapotransparation data from other AWAP #5

ivanhanigan opened this issue Jul 19, 2017 · 0 comments

Comments

@ivanhanigan
Copy link
Member

I have done a little exploration and this script as follows. The issue I found is you are requesting ESRI float files but it would be better to use the NetCDF files (but I could not see them in that FTP site).
from here you can either continue to try to use the ESRI files or find the nc files and rewrite to download the nc file and read that using the R package ncdf4

library(raster)

get_data<-function(startdate,enddate){
  url="ftp://ftp.eoc.csiro.au/pub/awap/Australia_historical/Run26j/FWPT/{startdate}_{enddate}.FWPT.run26j.flt.zip"
  url=gsub("{startdate}",startdate,url,fixed=TRUE)
  url=gsub("{enddate}",enddate,url,fixed=TRUE)
  download.file(url, sprintf("%s_%s%s.zip","FWPT",startdate,enddate) ,mode="wb")
}


get_data_range<-function(startdate,enddate){
  thisdate<-startdate
  while (thisdate<=enddate){
    get_data(format(as.POSIXct(thisdate),"%Y%m%d"),format(as.POSIXct(thisdate),"%Y%m%d"))
    thisdate<-thisdate+1
  }
}

###################

get_data("20130101","20131231")
#Decompress
startdate <- "20130101"
enddate <- "20131231"
infile <- sprintf("%s_%s%s.zip","FWPT",startdate,enddate)

unzip(infile)
```
# this shows that we have downloaded flt (ESRI Float) data but it would be much better to access the nc (NetCDF).
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant