Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

string in netcdf file python

import netCDF4
import numpy as np

str_out = netCDF4.stringtochar(np.array(['test'], 'S4'))

nc = netCDF4.Dataset('./test.nc', 'w', format='NETCDF4_CLASSIC')
nc.createDimension('lat', 1)
nc.createDimension('lon', 1)
nc.createDimension('nchar', 4)

lat = nc.createVariable('lat', 'f4', ('lat',))
lon = nc.createVariable('lon', 'f4', ('lon',))
place = nc.createVariable('place', 'S1', ('nchar'))

lat[:] = 17.002
lon[:] = -81.501
place[:] = str_out

nc.close()
Comment

PREVIOUS NEXT
Code Example
Python :: bag of word scikit learn 
Python :: split string with first numerical value in python 
Python :: python logging repeated messages 
Python :: pandas most and least occurrence value 
Python :: do while python using dates 
Python :: pytorch torchaudio torchvision cu113 
Python :: python add new key to dictionary 
Python :: how to do formatting in python with format function 
Python :: python indent print 
Python :: fit function tensorflow 
Python :: python download chromebook 
Python :: how to install python packages in local directory 
Python :: Python NumPy stack Function Example with 1d array 
Python :: us staes python 
Python :: random forest classifier classification report 
Python :: with function python 
Python :: quadratic equation python 
Python :: warnings.warn("DateTimeField %s received a naive datetime (%s)" 
Python :: print in pytest python 
Python :: how to get the end of a item in a python array 
Python :: add element to array list python 
Python :: python get bits from byte 
Python :: capitalise texts 
Python :: how to pre populate field flask wtforms 
Python :: remove duplicates in json python 
Python :: select column in pandas dataframe 
Python :: df.pivot_table 
Python :: openpyxl 
Python :: Uninstalling/removing a package is very easy with pip: 
Python :: # Python string capitalization 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =