Last active
May 29, 2020 22:43
-
-
Save aakash30jan/9ae0cf3dde8a63d28df5275873cb0f10 to your computer and use it in GitHub Desktop.
python3 venv packages for SampleCode.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
absl-py==0.9.0 | |
astor==0.8.1 | |
cachetools==4.1.0 | |
certifi==2020.4.5.1 | |
cftime==1.1.3 | |
chardet==3.0.4 | |
gast==0.2.2 | |
google-auth==1.16.0 | |
google-auth-oauthlib==0.4.1 | |
google-pasta==0.2.0 | |
grpcio==1.29.0 | |
h5py==2.10.0 | |
idna==2.9 | |
importlib-metadata==1.6.0 | |
Keras-Applications==1.0.8 | |
Keras-Preprocessing==1.1.2 | |
Markdown==3.2.2 | |
netCDF4==1.5.3 | |
numpy==1.17.3 | |
oauthlib==3.1.0 | |
opt-einsum==3.2.1 | |
protobuf==3.12.2 | |
pyasn1==0.4.8 | |
pyasn1-modules==0.2.8 | |
requests==2.23.0 | |
requests-oauthlib==1.3.0 | |
rsa==4.0 | |
six==1.15.0 | |
tensorboard==2.0.2 | |
tensorflow==2.0.0 | |
tensorflow-estimator==2.0.1 | |
termcolor==1.1.0 | |
urllib3==1.25.9 | |
Werkzeug==1.0.1 | |
wrapt==1.12.1 | |
zipp==3.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numpy==1.17.3 | |
tensorflow==2.0.0 | |
netCDF4==1.5.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
numpy 1.17.3 | |
tensorflow 2.0.0 | |
netCDF4 1.5.3 | |
Get these: "pip install -r https://gist.githubusercontent.com/aakash30jan/9ae0cf3dde8a63d28df5275873cb0f10/raw/9e8d7e1f84fc2f67fe842d75e8623756319786bb/requirements.txt" | |
Get full environment: "pip install -r https://gist.githubusercontent.com/aakash30jan/9ae0cf3dde8a63d28df5275873cb0f10/raw/9e8d7e1f84fc2f67fe842d75e8623756319786bb/frozen-requirements.txt" | |
""" | |
##The sequence of import which doesn't work | |
import numpy as np | |
import tensorflow as tf ### <<< if imported here, saving .nc doesn't work | |
import netCDF4 as nc | |
#import tensorflow as tf ### <<< if imported here, saving .nc works properly | |
print("I am TensorFlow ", tf.__version__, " but I have no job here") | |
print("I would let NetCDF4 ", nc.__version__," do it's job, for now") | |
Nx = 160 # just another number | |
outputfile = "outputfile.nc" # just another filename | |
ArrayField = np.ones((Nx,Nx,1)) # sample array to write | |
print("Writing field data of shape", ArrayField.shape) | |
ncfile = nc.Dataset("outputfile.nc",'w',format='NETCDF4_CLASSIC') | |
ncfile.createDimension('X',ArrayField.shape[0]) #line is probably okay | |
newx = ncfile.createVariable('X','d',('X')) #line is probably okay | |
newx[:] = np.linspace(0.00,1.00,ArrayField.shape[0]) #line is probably okay | |
velx = ncfile.createVariable('Component_X','d',('X','X')) #line is probably okay | |
velx[:] = ArrayField[:,:,0].T #line is probably okay | |
print("Something written to: ", outputfile) | |
ncfile.close() ###### <<<<<<< Gives error here | |
print("Data successfully written to: ", outputfile) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment