Menyimpan variabel dalam format netcdf (.nc) yang dapat dibaca Grads, R, python, matlab dll.
Project description
Denetcdf Package
Ini merupakan paket python untuk simpan variabel 3 dimensi ke dalam format netcdf yang bisa dibaca Grads, R, python, matlab dll.
Contoh 1 variabel: ##################### import denetcdf import netCDF4 as nc import numpy as np from wrf import getvar, vinterp, to_np, get_basemap, latlon_coords, extract_times, ALL_TIMES
fl = 'wrfout'
fh=nc.Dataset(fl[0]) lats=to_np(getvar(fh, "lat"))[:,0] lons=to_np(getvar(fh, "lon"))[0,:] fh.close() fh=[nc.Dataset(i) for i in fl];print(len(fl)) pm_10=[to_np(fh[i]['PM10']) for i in range(len(fl))];pm_10=np.squeeze(np.array(pm_10))
denetcdf.create('test.nc', lats, lons, 'Inaaqm Output', '20230905000000', 73, 'Particulate Matter 10 (g/kg)','pm10','g/kg', pm_10[:,0,:,:])
######################
Contoh multi-variabel: ###################### import denetcdf import netCDF4 as nc import numpy as np from wrf import getvar, vinterp, to_np, get_basemap, latlon_coords, extract_times, ALL_TIMES
fl = 'wrfout'
fh=nc.Dataset(fl[0]) lats=to_np(getvar(fh, "lat"))[:,0] lons=to_np(getvar(fh, "lon"))[0,:] fh.close() fh=[nc.Dataset(i) for i in fl] titles=[];vars=[];units=[];data=[] titles.append('Particulate Matter 10 (g/kg)') vars.append('pm10') units.append('g/kg') pm_10=[to_np(fh[i]['PM10']) for i in range(len(fl))];data.append(np.squeeze(np.array(pm_10))[:,0,:,:]) titles.append('Particulate Matter 2.5 (g/kg)') vars.append('pm25') units.append('g/kg') pm_25=[to_np(fh[i]['PM2_5_DRY']) for i in range(len(fl))];data.append(np.squeeze(np.array(pm_10))[:,0,:,:]) titles.append('Sulfur dioxide (SO2) (ppm)') vars.append('so2') units.append('ppm') pm_so=[to_np(fh[i]['so2']) for i in range(len(fl))];data.append(np.squeeze(np.array(pm_10))[:,0,:,:]) titles.append('Carbon monoxide (CO) (ppm)') vars.append('co') units.append('ppm') pm_co=[to_np(fh[i]['co']) for i in range(len(fl))];data.append(np.squeeze(np.array(pm_10))[:,0,:,:]) data=np.array(data)
denetcdf.create('testm.nc', lats, lons, 'Inaaqm Output', '20230905000000', len(fl), titles,vars,units, data)
######################
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file denetcdf-0.0.1.tar.gz
.
File metadata
- Download URL: denetcdf-0.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6c1a701a97a43ece82546a3fee22c502456b488a83e745fc88292d367fa9f63 |
|
MD5 | 0485ad94fe55f822ca3e2c85887a98a8 |
|
BLAKE2b-256 | 636335f156d54ed6dfb33d51e3131d55f395246589649cf82e0ea7c18555192c |
Provenance
File details
Details for the file denetcdf-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: denetcdf-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9193bb645572335571f088f947ca3733de6e31da386107692c82340e9593e887 |
|
MD5 | e0b624c352914a0249a5f9e403dce0b8 |
|
BLAKE2b-256 | 1548bc5d13439712e9f6360e36fd8cabe975ce39e05d82b459368fb50c97eee4 |