Skip to main content

a python API for cma nwfd-grib2 c/c++ api

Project description

this is a python api for cma nwfd-grib2 c/c++ library.

install_requires:

python3

installing:

pip install pynwfd

how to use:

from pynwfd.grib_write import *
import numpy as np

data_size=193*220
grib_size=(500+data_size*4)*12 #12 hour,193*220 points,float type 
cgrib=(c_ubyte*grib_size)()

data=np.zeros((12,193,220))-1
data[1,10:20,10:20]=63

filename='leo-null.grb2'
#status=0:业务产品 1:测试产品 2:科研产品 3:再分析 
lens=Nwfd().nwfd_create(cgrib,2021, 3, 28, 8, 0, 0,status=0)
# def nwfd_addgrid(self,cgrib,slon,elon,slat,elat,DX,DY,Ni,Nj):
lens=Nwfd().nwfd_addgrid(cgrib, 101.05, 112, 22.1, 31.7, 0.05, 0.05, 220, 193)
for i in range(12):
    #  def nwfd_addfield_jpeg(self,cgrib,category,element,statistical, year, month, day, hour, minute,second, 
    #                                forecasttime, timerange, data, ngrdpts, leveltype, level, isforecast=True, istimepoint=False)
    lens=Nwfd().nwfd_addfield_jpeg(cgrib,1,201,0,2021,3,28,8,0,0,i+1,1,data[i,:,:],data_size,1,0,True,False)
lens=Nwfd().nwfd_end(cgrib)
lens=Nwfd().nwfd_savetofile(cgrib, lens, grib2file=filename)

the last:

send email to me ,if have issues,also suggests.

email: dpqnju@126.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynwfd-0.0.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynwfd-0.0.1-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file pynwfd-0.0.1.tar.gz.

File metadata

  • Download URL: pynwfd-0.0.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pynwfd-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a7e34e37d54190a423ca40f2ab241bedd9252a338765ed560ceef1eab60784dc
MD5 c9ad4eec010f5ad7ecf6785a665f7c3a
BLAKE2b-256 6dff74e37b37f563c14641b2529927e5fd9c124e2291d1d073e84f34a69eeab5

See more details on using hashes here.

File details

Details for the file pynwfd-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pynwfd-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for pynwfd-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10326c479190258e247dfe50fbcc37cb169c3524ee8a6eb97836a56fd99ee409
MD5 2e02a9324c8f959668022660428c9603
BLAKE2b-256 9fcef54e05509da61775ee57d7e55861581ee41521d8a45a42b36b05e5927ebf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page