NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Great! Many thanks for your help! Annelie -----Ursprüngliche Nachricht----- Von: David Pierce [mailto:dpierce@xxxxxxxx] Gesendet: Wednesday, July 28, 2010 7:12 PM An: Holzkaemper Annelie ART Cc: roy.mendelssohn@xxxxxxxx; netcdfgroup@xxxxxxxxxxxxxxxx Betreff: Re: AW: [netcdfgroup] transfering netCDF-file from R to ArcGIS Hm, looks like a bug in that version of the library. Note that ncdf4 is the new version and the one I maintain. ncdf4 supports netcdf version 4, including chunking and compression, but also *requires* netcdf-v4 with the full HDF support, so it's harder to install. In any event, this works: --------------------------------- library(ncdf) my.nc = open.ncdf("pointtest8.nc", write=TRUE) dim_id <- my.nc$dim[[1]] varz = var.def.ncdf("Precipitation","km", list(dim_id), -9999, longname="Daily precipitation", prec="double") my.nc <- var.add.ncdf(my.nc, varz) att.put.ncdf( my.nc, varz$name, "coordinates", "x y" ) close.ncdf(my.nc) Regards, --Dave annelie.holzkaemper@xxxxxxxxxxxx wrote: > Hi Dave, > many thanks for this! Unfortunately I get an error message when I add > "att.put.ncdf( my.nc, varz, "coordinates", "x y" )" as you suggested. > Here is what I get: > > >> varz = var.def.ncdf("Precipitation","km", list(dim_id), -9999, > + longname="Daily precipitation", prec="double") >> att.put.ncdf( my.nc, varz, "coordinates", "x y") > [[1]] > [1] 4 > >> my.nc <- var.add.ncdf(my.nc, varz) > Error in var.add.ncdf(my.nc, varz) : Error in create.ncdf, defining var! > > > Annelie > > > -----Ursprüngliche Nachricht----- > Von: David Pierce [mailto:dpierce@xxxxxxxx] > Gesendet: Wednesday, July 28, 2010 6:40 PM > An: Holzkaemper Annelie ART > Cc: roy.mendelssohn@xxxxxxxx; netcdfgroup@xxxxxxxxxxxxxxxx > Betreff: Re: [netcdfgroup] transfering netCDF-file from R to ArcGIS > > Hi Annelie, > > I'm the author of the ncdf package for R. Thanks for using it! > > It looks to me like ArcGIS is using the "coordinate" attribute to > figure this information out. Try adding the following line right > after the > "var.def.ncdf": > > att.put.ncdf( my.nc, varz, "coordinates", "x y" ) > > Regards, > > --Dave > > > annelie.holzkaemper@xxxxxxxxxxxx wrote: >> Hi Roy, >> thanks for the fast response. I attached the two versions of the >> netCDF file (before and after running the R script). >> I haven't tried to use ncdump yet, but I will. >> >> Annelie >> >> -----Ursprüngliche Nachricht----- >> Von: Roy Mendelssohn [mailto:Roy.Mendelssohn@xxxxxxxx] >> Gesendet: Wednesday, July 28, 2010 5:58 PM >> An: Holzkaemper Annelie ART >> Cc: netcdfgroup@xxxxxxxxxxxxxxxx >> Betreff: Re: [netcdfgroup] transfering netCDF-file from R to ArcGIS >> >> Hi Annelie: >> >> Since this involves a lot more than netcdf (R, ArcGIS), a little >> more info would help. Do you access to the ncdump utility? Can you >> do an "ncdump -h" on the files with and without precipitation? >> otherwise, if the files aren't toobig, can you send them somehow. >> >> Also, the ArcGIS netcdf import is (unfortunately) known to be buggy. >> >> -Roy >> >> On Jul 28, 2010, at 8:27 AM, annelie.holzkaemper@xxxxxxxxxxxx wrote: >> >>> Hi, >>> I am trying to generate a NetCDF file in R that can be imported in >>> ArcGIS using the "Make NetCDF Feature Layer" tool (it is supposed to >>> store time series data for each climate station). I have used an >>> ArcGIS point-shapefile and converted it into a NetCDF file that I >>> can use as a template. This file has 1 dimension (the point ID) and >>> 3 variables (x coordinate, y coordinate, elevation). It can easily >>> be imported to ArcGIS using "Make NetCDF Feature Layer". >>> But now I want to add a new variable ("precipitation") to the >>> netcdf-file in R: >>> >>> >>library(ncdf) >>> >>my.nc = open.ncdf("C:/temp/pointtest8.nc", write=TRUE) >>> >>> >>dim_id <- my.nc$dim[[1]] >>> >>> >>varz = var.def.ncdf("Precipitation","km", list(dim_id), -9999, >>> longname="Daily precipitation", prec="double") >>> >>> >>my.nc <- var.add.ncdf(my.nc, varz) >>> >>> >>close.ncdf(my.nc) >>> >>> >>> If I try to import the file modified with R into ArcGIS ("Make >>> NetCDF Feature Layer") and choose "precipitation" instead of >>> "elevation" as a variable, I can not choose the x and y variables >>> (there are no options in the drop down list). However, it is still >>> possible to choose the x and y variables for "elevation". So, there >>> seems to be some sort of link between the original variable >>> "elevation" and the >>> x- and y-variables that I have not defined for my new variable >>> "precipitation" in R. What could be wrong with my definition of the >>> new variable? >>> >>> I would be very grateful for any suggestions! >>> >>> Cheers, >>> Annelie >>> >>> >>> >>> >>> >>> >>> _______________________________________________ >>> netcdfgroup mailing list >>> netcdfgroup@xxxxxxxxxxxxxxxx >>> For list information or to unsubscribe, visit: >>> http://www.unidata.ucar.edu/mailing_lists/ >> >> ********************** >> "The contents of this message do not reflect any position of the U.S. >> Government or NOAA." >> ********************** >> Roy Mendelssohn >> Supervisory Operations Research Analyst NOAA/NMFS Environmental >> Research Division Southwest Fisheries Science Center >> 1352 Lighthouse Avenue >> Pacific Grove, CA 93950-2097 >> >> e-mail: Roy.Mendelssohn@xxxxxxxx (Note new e-mail address) >> voice: (831)-648-9029 >> fax: (831)-648-8440 >> www: http://www.pfeg.noaa.gov/ >> >> "Old age and treachery will overcome youth and skill." >> "From those who have been given much, much will be expected" >> >> _______________________________________________ >> netcdfgroup mailing list >> netcdfgroup@xxxxxxxxxxxxxxxx >> For list information or to unsubscribe, visit: >> http://www.unidata.ucar.edu/mailing_lists/ > > > ------------------------------------------------------------------- > David W. Pierce > Division of Climate, Atmospheric Science, and Physical Oceanography > Scripps Institution of Oceanography > (858) 534-8276 (voice) / (858) 534-8561 (fax) dpierce@xxxxxxxx > ------------------------------------------------------------------- > > > > ------------------------------------------------------------------- David W. Pierce Division of Climate, Atmospheric Science, and Physical Oceanography Scripps Institution of Oceanography (858) 534-8276 (voice) / (858) 534-8561 (fax) dpierce@xxxxxxxx -------------------------------------------------------------------
netcdfgroup
archives: