netcdf

NetCDF and Python: Finding the closest lon/lat index given actual lon/lat values

浪尽此生 提交于 2019-11-27 06:21:43
问题 I'd like to be able to find the lon/lat coordinate indices of the closest location to a lon/lat tuple. This is already available in the Java API as GridCoordSystem.findXYindexFromLatLon(), but I haven't found anything comparable in the Python API. What I'm hoping to find in the API, or write myself and contribute to the API (if useful), is something like this: def get_indices(netcdf_dataset, lon_value, lat_value): ''' :param netcdf_dataset an open NetCDF data set object :param lon_value a

Loop through netcdf files and run calculations - Python or R

只愿长相守 提交于 2019-11-27 05:51:11
问题 This is my first time using netCDF and I'm trying to wrap my head around working with it. I have multiple version 3 netcdf files (NOAA NARR air.2m daily averages for an entire year). Each file spans a year between 1979 - 2012. They are 349 x 277 grids with approximately a 32km resolution. Data was downloaded from here. The dimension is time (hours since 1/1/1800) and my variable of interest is air. I need to calculate accumulated days with a temperature < 0. For example Day 1 = +4 degrees,

The variable from a netcdf file comes out flipped

点点圈 提交于 2019-11-27 03:40:29
问题 I have downloaded a nc file from f=open.ncdf("file.nc") [1] "file Lfile.nc has 2 dimensions:" [1] "Longitude Size: 1440" [1] "Latitude Size: 720" [1] "------------------------" [1] "file filr.nc has 8 variables:" [1] "short ts[Latitude,Longitude] Longname:Skin Temperature (2mm) Missval:NA" I then wanted to work with the variable soil_moisture_c A = get.var.ncdf(nc=f,varid="soil_moisture_c",verbose=TRUE) I then plot A with image(A) . I got the map shown below,I even transposed it image(t(a))