Guest User

Untitled

a guest
Nov 14th, 2017
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. import netCDF4 as nc
  2.  
  3. ncfile = nc.Dataset("/pathway/file.nc", "r")
  4.  
  5. ncfile.dimensions.keys()
  6. [u'time', u'lat', u'lon', u'bnds']
  7.  
  8. ncfile.variables.keys()
  9. [u'time', u'time_bnds', u'lat', u'lat_bnds', u'lon', u'lon_bnds', u'snc']
  10.  
  11. for attr in ncfile.ncattrs():
  12. print attr, '=', getattr(ncfile, attr)
  13.  
  14. institution = CCCma (Canadian Centre for Climate Modelling and Analysis, Victoria, BC, Canada)
  15. institute_id = CCCma
  16. experiment_id = rcp85
  17. source = CanESM2 2010 atmosphere: CanAM4 (AGCM15i, T63L35) ocean: CanOM4 (OGCM4.0, 256x192L40) and CMOC1.2 sea ice: CanSIM1 (Cavitating Fluid, T63 Gaussian Grid) land: CLASS2.7 and CTEM1
  18. model_id = CanESM2
  19. forcing = GHG,Oz,SA,BC,OC,LU,Sl (GHG includes CO2,CH4,N2O,CFC11,effective CFC12. Sl is the repeat of the 23rd solar cycle, years 1997-2008, after year 2008.)
  20. parent_experiment_id = historical
  21. parent_experiment_rip = r1i1p1
  22. branch_time = 56940.0
  23. contact = cccma_info@ec.gc.ca
  24. references = http://www.cccma.ec.gc.ca/models
  25. initialization_method = 1
  26. physics_version = 1
  27. tracking_id = ebf1ab27-15be-45df-a8f3-dbac739f9191
  28. branch_time_YMDH = 2006:01:01:00
  29. CCCma_runid = IDR
  30. CCCma_parent_runid = IGM
  31. CCCma_data_licence = 1) GRANT OF LICENCE - The Government of Canada (Environment Canada) is the
  32. owner of all intellectual property rights (including copyright) that may exist in this Data
  33. product. You (as "The Licensee") are hereby granted a non-exclusive, non-assignable,
  34. non-transferable unrestricted licence to use this data product for any purpose including
  35. the right to share these data with others and to make value-added and derivative
  36. products from it. This licence is not a sale of any or all of the owner's rights.
  37. 2) NO WARRANTY - This Data product is provided "as-is"; it has not been designed or
  38. prepared to meet the Licensee's particular requirements. Environment Canada makes no
  39. warranty, either express or implied, including but not limited to, warranties of
  40. merchantability and fitness for a particular purpose. In no event will Environment Canada
  41. be liable for any indirect, special, consequential or other damages attributed to the
  42. Licensee's use of the Data product.
  43. product = output
  44. experiment = RCP8.5
  45. frequency = mon
  46. creation_date = 2011-03-17T20:06:09Z
  47. history = 2011-03-17T20:06:09Z CMOR rewrote data to comply with CF standards and CMIP5 requirements.
  48. Conventions = CF-1.4
  49. project_id = CMIP5
  50. table_id = Table LImon (31 January 2011) 6f05b7e5f64aaa34bcac127ca47ac655
  51. title = CanESM2 model output prepared for CMIP5 RCP8.5
  52. parent_experiment = historical
  53. modeling_realm = landIce land
  54. realization = 1
  55. cmor_version = 2.5.4
  56.  
  57. snc= ncfile.variables["snc"][:][0]
  58.  
  59. array([[-90. , -86.48016542],
  60. [-86.48016542, -83.70472247],
  61. [-83.70472247, -80.91926226],
  62. [-80.91926226, -78.13125563],
  63. [-78.13125563, -75.34220992],
  64. [-75.34220992, -72.55263609],
  65. [-72.55263609, -69.76275656],
  66. [-69.76275656, -66.97268406],
  67.  
  68. xmin, ymin, xmax, ymax = [lon.min(), lat.min(), lon.max(), lat.max()]
  69.  
  70. (0.0, -87.863801343710804, 357.1875, 87.863801343710804)
Add Comment
Please, Sign In to add comment