Web Content Display

Web Content Display (CoastWatch User Forum)

The NOAA CoastWatch Forum provides information in several categories.  The information is relevant to CoastWatch products and software (https://coastwatch.noaa.gov)  and vary in technical details.  For questions and issues not addressed here,  start a thread in the appropriate category or contact the CoastWatch HelpDesk (coastwatch.info@noaa.gov).  Please note our Privacy Policy (https://www.noaa.gov/privacy.html) and that this is a public forum.  All information is voluntarily and anonymous submissions are accepted pending review prior to posting. 

Forums

Back

RE: NaN values extracted

MW
Morgan Winston, modified 4 Years ago.

NaN values extracted

Youngling Posts: 12 Join Date: 9/6/17 Recent Posts

Good morning,

I am able to download DHW and SST data for all my islands of interest in Hawaii across time (1986-2019), except for Kure. All the values I get for Kure are NaN. This is using R, but when I try to download data directly from OW ERRDAP site it works! Wondering why that could be and how I could fix this because I would like to use R to download all my data. (And still having problems getting data anywhere in 1985, I put this question on the Agenda/in my other thread).

Here is the code I am using to get the DHW and SST data, which works and gives me actual values for all other islands:

  isl_2 <- isl[ which(isl$ISLAND_CD == names[i]),] # subset to island as specified by names[i] 
  isl_2=st_coordinates(isl_2) # retrieves coordinates in matrix form for that island that we want data for
  
  poly <- as.data.frame(isl_2[,1:2]) # turn into a data frame
  names(poly) <- c("lon","lat") # add column names to coordinates
  
  # convert the longitudes to 0-360º to make it easier to work across the dateline
  I=which(poly$lon<0)
  poly$lon[I]=poly$lon[I]+360 

  ## extraction begins ##
  xcoord <- poly$lon # set boundaries ~ for Kure this is: 181.6495, 181.7218
  ycoord <- poly$lat ## for Kure this is: 28.37772 28.40958
  tcoord <- c(paste(years[j],"-01-01", sep = ""), paste(years[j],"-12-31", sep = "")) # set the time period we pull data for

  # set data info for sst
  dataInfo <- rerddap::info('CRW_sst_v1_0', url=ERDDAP_Node) # define what dataset we want
  dataInfo$variable$variable_name # choose from these variables: "analysed_sst" "sea_ice_fraction"
  parameter=dataInfo$variable$variable_name[1] # select sst as parameter of interest
  sst <- rxtractogon(dataInfo, parameter=parameter, xcoord=xcoord, ycoord=ycoord, tcoord=tcoord) # extract sst data
  
  # set data info for dhw
  dataInfo_2 <- rerddap::info('CRW_dhw_v1_0', url=ERDDAP_Node)
  dataInfo_2$variable$variable_name 
  parameter_2=dataInfo_2$variable$variable_name[1]
  dhw <- rxtractogon(dataInfo_2, parameter=parameter_2, xcoord=xcoord, ycoord=ycoord, tcoord=tcoord) # extract dhw data

Thanks!!!

Morgan

MA
Melanie Abecassis, modified 4 Years ago.

RE: NaN values extracted

Youngling Posts: 65 Join Date: 6/12/17 Recent Posts

Hi Morgan, not sure.... can you attach your data so I can give it a try on my laptop?

MS
Michael Soracco, modified 4 Years ago.

RE: NaN values extracted

Youngling Posts: 39 Join Date: 8/11/16 Recent Posts

Morgan,

That is odd. There are many zeroes,  but that shouldn't be NaN.  

What do you see for Kure in this time period?  
1989-09-25T12:00:00Z - 1990-01-01T12:00:00Z

Michael

MW
Morgan Winston, modified 4 Years ago.

RE: NaN values extracted

Youngling Posts: 12 Join Date: 9/6/17 Recent Posts

Hi Melanie and Michael,

I am attaching my code and the shapefile(s). FYI the for loop takes a LONGGGG time to run when I let it go for all the years of interest and islands. At this point I have used it to successfully get data for 1986-2019 for all my islands of interest except for Kure. And no data from 1985.

MW
Morgan Winston, modified 4 Years ago.

RE: NaN values extracted

Youngling Posts: 12 Join Date: 9/6/17 Recent Posts
CW
Cara Wilson, modified 4 Years ago.

RE: NaN values extracted

Youngling Posts: 41 Join Date: 6/12/17 Recent Posts

Morgan - 

 

The reason it is taking so long is that you are getting the daily dataset from 1986-2019, so 44 years of data.  Usually when people are interested in looking at time series of these length we suggest looking at monthly or weekly data, but I see that this dataset does not have that option.  I will take a look at your code and see if I can't figure out what the other issues are. 

 

Cara 

MW
Morgan Winston, modified 4 Years ago.

RE: NaN values extracted

Youngling Posts: 12 Join Date: 9/6/17 Recent Posts

I'm fine with it taking a long time (and I assumed it would, especially because my internet is slow...) as I am building time series plots, where each day is plotted.